org.axonframework.eventhandling.io
Class EventMessageReader
java.lang.Object
org.axonframework.eventhandling.io.EventMessageReader
public class EventMessageReader
- extends Object
Reader that reads EventMessage instances written to the underlying input. Typically, these messages have been
written using a EventMessageWriter
. This reader distinguishes between DomainEventMessage and regular
EventMessage implementations and will reconstruct an instance implementing that same interface when reading.
- Since:
- 2.0
- Author:
- Allard Buijze
Constructor Summary |
EventMessageReader(DataInputStream input,
Serializer serializer)
Creates a new EventMessageReader that reads the data from the given input and deserializes payload
and meta data using the given serializer . |
Method Summary |
|
readEventMessage()
Reads an EventMessage from the underlying input. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventMessageReader
public EventMessageReader(DataInputStream input,
Serializer serializer)
- Creates a new EventMessageReader that reads the data from the given
input
and deserializes payload
and meta data using the given serializer
.
- Parameters:
input
- The input providing access to the written dataserializer
- The serializer to deserialize payload and meta data with
readEventMessage
public <T> EventMessage<T> readEventMessage()
throws IOException
- Reads an EventMessage from the underlying input. If the written event was a DomainEventMessage, an instance of
DomainEventMessage is returned.
- Type Parameters:
T
- The type of payload expected to be in the returned EventMessage. This is not checked at runtime!
- Returns:
- an EventMessage representing the message originally written, or
null
if the stream has
reached the end
- Throws:
IOException
- when an error occurs reading from the underlying input
EOFException
- when the end of the stream was reached before the message was entirely read
UnknownSerializedTypeException
- if the type of the serialized object cannot be resolved to a class
Copyright © 2010-2016. All Rights Reserved.