Package com.qfs.msg
Interface IMessage<I,E>
- Type Parameters:
I- the type of the message identifierE- the type of the data elements appended into message chunks.
- All Known Subinterfaces:
IStoreMessage<I,E>
- All Known Implementing Classes:
AStoreMessage,StoreMessage
public interface IMessage<I,E>
A message contains data loaded from a data source, and transferred to a destination through a
message channel.
The message itself is made of zero, one or more chunks.
A message is qualified by an identifier that depends on the data source implementation.
- Author:
- ActiveViam
-
Method Summary
Modifier and TypeMethodDescriptionvoidappend(IMessageChunk<E> chunk) Append a message chunk into this message.Returns the identifier of the message.newChunk()Instantiate a new chunk to collect a block of data within that message.voidNotifies the message that an error was raised while preparing its content.voidonPublished(IPublicationInfo info) Called after the message has been successfully published.voidCalled after this message has been started.
-
Method Details
-
getIdentifier
I getIdentifier()Returns the identifier of the message. -
newChunk
IMessageChunk<E> newChunk()Instantiate a new chunk to collect a block of data within that message. Several chunks may be created and filled with data concurrently, from several threads. The message chunk factory method must therefore be thread safe.- Returns:
- new chunk
-
append
Append a message chunk into this message. When the data source has filled a chunk of data, it appends it into the message by calling this method. At that time, the chunk is considered complete, and no new data will be put into the chunk.
Note : In some implementations, the publishing of the chunk is done during this method, leaving nothing to do duringIMessageChannel.send(IMessage). This is the case for store messages in non-accumulating mode.- Parameters:
chunk- The chunk to append into this message.
-
onError
Notifies the message that an error was raised while preparing its content.This method is supposed to gracefully handle the error without failure. Particularly, throwing in this method results in an undefined behaviour, including the unexpected stoppage of this message processing, as well as the rest of the process.
- Parameters:
e- The exception that occurred.
-
onStarted
void onStarted()Called after this message has been started. -
onPublished
Called after the message has been successfully published.- Parameters:
info- publication information (optional, may be null depending on the data source)
-