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 aMessage
based on an entity instance.default org.springframework.messaging.Message<T>
createMessage
(Object entity, Map<String, Object> attributes) Create aMessage
based on an entity instance.
-
Method Details
-
createMessage
Create aMessage
based 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 aMessage
based on an entity instance. This method is called when the originating entity is an instance ofMessageAdditionalInformationAware
. In this case,MessageAdditionalInformationAware.unwrap()
is called for theentity
parameter, andMessageAdditionalInformationAware.getAttributes()
is called to fulfill theattributes
parameter before entering this method. SeeDefaultNotificationHandler.notify(NotificationStateAware, NotificationState, NotificationStateRepository)
for more information on caller behavior.- Parameters:
entity
- The entity whose information informs theMessage
attributes
- Additional attributes used duringMessage
creation- Returns:
- The message to send via the
NotificationHandler
-