Interface MessageFactory<T>
- All Known Implementing Classes:
PersistenceMessageFactory
public interface MessageFactory<T>
Factory for creating a
Message to be sent via NotificationHandler, based on an
entity.- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.messaging.Message<T>createMessage(Object entity) Create aMessagebased on an entity instance.default org.springframework.messaging.Message<T>createMessage(Object entity, Map<String, Object> attributes) Create aMessagebased on an entity instance.
-
Method Details
-
createMessage
Create aMessagebased on an entity instance.- Parameters:
entity- The entity whose information informs theMessage- Returns:
- The message to send via the
NotificationHandler
-
createMessage
default org.springframework.messaging.Message<T> createMessage(Object entity, Map<String, Object> attributes) Create aMessagebased on an entity instance. This method is called when the originating entity is an instance ofMessageAdditionalInformationAware. In this case,MessageAdditionalInformationAware.unwrap()is called for theentityparameter, andMessageAdditionalInformationAware.getAttributes()is called to fulfill theattributesparameter before entering this method. SeeDefaultNotificationHandler.notify(NotificationStateAware, NotificationState, NotificationStateRepository)for more information on caller behavior.- Parameters:
entity- The entity whose information informs theMessageattributes- Additional attributes used duringMessagecreation- Returns:
- The message to send via the
NotificationHandler
-