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 Type
    Method
    Description
    Retrieves the topic of this channel.
    <T extends I>
    IMessage<T,E>
    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>
    void
    send(IMessage<T,E> message)
    Sends a message through the channel.
    <T extends I>
    void
    sendMessage(T identifier, Collection<? extends E> elements)
    Creates a new message and sends it through the channel.
    Installs a message handler on this channel.
  • Method Details

    • getTopic

      String getTopic()
      Retrieves the topic of this channel.
      Returns:
      The channel's topic
    • newMessage

      <T extends I> IMessage<T,E> newMessage(T identifier)
      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

      <T extends I> void send(IMessage<T,E> message)
      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 the IMessage.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

      <T extends I> void sendMessage(T identifier, Collection<? extends E> elements)
      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

      IMessageChannel<I,E> withMessageHandler(IMessageHandler<I> messageHandler)
      Installs a message handler on this channel.
      Parameters:
      messageHandler - the new message handler
      Returns:
      this channel after its message handler has been updated