Package com.qfs.msg
Interface IMessageChannel<I,E>
- Type Parameters:
I- type of the identifiers of messages.E- type of the data elements appended into message chunks.
- All Known Subinterfaces:
IStoreCompositeMessageChannel<I,,E> IStoreMessageChannel<I,E>
- All Known Implementing Classes:
AMessageChannel,AStoreMessageChannel,CompositeMessageChannel,CompositeStoreMessageChannel,StoreMessageChannel
public interface IMessageChannel<I,E>
The message channel interface.
This channel listens or fetches the data from a data source. It uses the specific information (message identifier) for this channel to notify which element has started or completed.
- Author:
- ActiveViam
-
Method Summary
Modifier and TypeMethodDescriptiongetTopic()Retrieves the topic of this channel.newMessage(T identifier) Creates a new message that will collect data elements from the source, and then be sent through the channel.<T extends I>
voidSends a message through the channel.<T extends I>
voidsendMessage(T identifier, Collection<? extends E> elements) Creates a new message and sends it through the channel.withMessageHandler(IMessageHandler<I> messageHandler) Installs a message handler on this channel.
-
Method Details
-
getTopic
String getTopic()Retrieves the topic of this channel.- Returns:
- The channel's topic
-
newMessage
Creates a new message that will collect data elements from the source, and then be sent through the channel.- Type Parameters:
T- Type of the message identifier.- Parameters:
identifier- the identifier of the message- Returns:
- the created message
-
send
Sends a message through the channel. The channel always supports sending the message instances it has created, but only optionally supports sending other message types.
Note : In some message implementations, the publishing of partial messages is already done during theIMessage.append(IMessageChunk)method (for example, on store messages in non-accumulating mode). In that case, calling this method will have no further effect.- Type Parameters:
T- Type of the message identifier.- Parameters:
message- The message to send through the channel.
-
sendMessage
Creates a new message and sends it through the channel. This is a utility method that combines creating the message, creating a message chunk to hold the elements and appending it to the message, and then sending the message.- Type Parameters:
T- Type of the message identifier.- Parameters:
identifier- The identifier of the new message to create.elements- The elements to add in the message to send through the channel.- See Also:
-
withMessageHandler
Installs a message handler on this channel.- Parameters:
messageHandler- the new message handler- Returns:
- this channel after its message handler has been updated
-