Package com.sap.cds.services.messaging
Interface MessagingService
- All Superinterfaces:
Service
Messaging service.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the compositeMessagingService
static final String
The messaging error event, that allows to handle acknowledgement of a message on the messaging channel -
Method Summary
Modifier and TypeMethodDescriptionvoid
If the service is not configured with the structured flag (default), the message is sent to the specified topic of this message broker as is.void
If the service is not configured with the structured flag (default), the message Map is serialized to JSON and sent to the specified topic of this message broker as is.void
Takes a (cloudevents) message, separated into data and headers and sends it to the specified topic of this message broker.
-
Field Details
-
COMPOSITE_NAME
The name of the compositeMessagingService
- See Also:
-
EVENT_MESSAGING_ERROR
The messaging error event, that allows to handle acknowledgement of a message on the messaging channel- See Also:
-
-
Method Details
-
emit
If the service is not configured with the structured flag (default), the message is sent to the specified topic of this message broker as is. If the service is configured with the structured flag, the message String is converted into a Map following the rule: {message: message} The Map is then interpreted as data map and passed toemit(String, Map)
. Usually this results in a final message like: {data: {message: message}}- Parameters:
topic
- the topicmessage
- the message to be sent
-
emit
If the service is not configured with the structured flag (default), the message Map is serialized to JSON and sent to the specified topic of this message broker as is. If the service is configured with the structured flag, the message Map is interpreted as data map and passed toemit(String, Map, Map)
. Usually this results in a final message like: {data: message}- Parameters:
topic
- the topicmessage
- the Map to be serialized to JSON and then sent
-
emit
Takes a (cloudevents) message, separated into data and headers and sends it to the specified topic of this message broker. This method produces the same final message, regardless of the structured flag. Usually data and headers are combined into a final JSON string message following the rule: {...headers, data: data}. Brokers (e.g. Kafka) that do natively support headers are able to separate headers from data, when using this method.- Parameters:
topic
- the topicdata
- the data Mapheaders
- the headers Map
-