Package com.caplin.datasource.messaging
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 theCachingPublisher.getCachedMessageFactory()
method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonMessage
createJsonMessage(String subject, Object userObject)
Creates a JSON message for the given subject.SubjectErrorEvent
createSubjectErrorEvent(String subject, SubjectError error, SubjectError.Flags... flags)
Creates a subject error event.SubjectStatusEvent
createSubjectStatusEvent(String subject, SubjectStatus status, String message)
Creates a subject status event.
-
-
-
Method Detail
-
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.
-
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.
-
-