Interface CachedMessageFactory


public interface CachedMessageFactory

A message factory is used to create cached DataSource messages that can be published to other DataSources.

 

You do not have to implement this interface yourself. An implementation is provided, and can be retrieved from any CachingPublisher by calling the CachingPublisher.getCachedMessageFactory() method.

  • Method Details

    • createJsonMessage

      JsonMessage createJsonMessage(String subject, Object userObject)
      Creates a JSON message for the given subject.
      Parameters:
      subject - The subject of the message.
      userObject - A Java object to be serialized using the installed JsonHandler.
      Returns:
      A new JSON message.
    • createRecordType1Message

      RecordType1Message createRecordType1Message(String subject)

      Creates a Record message to which Type 1 structured data can be added. After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.

       

      The returned message contains no data. To populate the message with data, use the appropriate methods of RecordType1Message.

      Parameters:
      subject - The subject of the Record.
      Returns:
      A new Type 1 Record message.
    • createGenericMessage

      GenericMessage createGenericMessage(String subject)

      Creates an empty Generic message to which structured data can be added. After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.

       

      Generic messages can be used without specifying field mappings in a separate adapter configuration file. This may be useful when receiving updates from a provider which supplies a variable or unknown number of fields. The returned message contains no data. To populate the message with data, use the appropriate methods of GenericMessage.

      Parameters:
      subject - The subject of the Record.
      Returns:
      A new Generic Type message.
    • createMappingMessage

      MappingMessage createMappingMessage(String subject, String mapping)

      Creates a MappingMessage for mapping subjects. After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.

       

      The returned message contains the mapped subject.

      Parameters:
      subject - The subject of the message.
      mapping - The mapped subject of the message
      Returns:
      A new MappingMessage.
    • createContainerMessage

      ContainerMessage createContainerMessage(String subject)

      Creates a message that defines a container. The name of the container is the given subject. After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.

      Parameters:
      subject - The subject defining the name of the container.
      Returns:
      A message defining the container.
    • createSubjectErrorEvent

      SubjectErrorEvent createSubjectErrorEvent(String subject, SubjectError error, SubjectError.Flags... flags)
      Creates a subject error event.
      Parameters:
      subject - The subject to which the error relates.
      error - The error.
      flags - Additional flags to be set on the nodata
      Returns:
      A subject error event.
    • createSubjectStatusEvent

      SubjectStatusEvent createSubjectStatusEvent(String subject, SubjectStatus status, String message)
      Creates a subject status event.
      Parameters:
      subject - The subject to which the status relates.
      status - The status.
      message - A free form textual message indicating the reason for the status message being raised.
      Returns:
      A subject status event.