public abstract class AbstractMessagingService extends ServiceDelegator implements MessagingService
MessagingService interface.| Modifier and Type | Field and Description |
|---|---|
protected MessageQueue |
queue |
protected CdsRuntime |
runtime |
protected CdsProperties.Messaging.MessagingServiceConfig |
serviceConfig |
COMPOSITE_NAME| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMessagingService(CdsProperties.Messaging.MessagingServiceConfig serviceConfig,
CdsRuntime runtime) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
createOrUpdateQueuesAndSubscriptions()
Performs the initialization of the messaging service, by initializing the queues and registering the topic subscriptions.
|
protected abstract void |
createQueue(String name,
Map<String,String> properties)
Request the broker for creating a queue with the specified queue name.
|
protected abstract void |
createQueueSubscription(String queue,
String topic)
Requests the broker for creating a queue topic subscription.
|
void |
emit(EventContext context) |
void |
emit(String topic,
Map<String,Object> message) |
void |
emit(String topic,
String message) |
protected abstract void |
emitTopicMessage(String topic,
String message)
Performs the message emit on the messaging broker.
|
void |
init()
Performs the initialization of the messaging service, by initializing the queues and registering the topic subscriptions.
|
void |
on(String[] events,
String[] entities,
int order,
Handler handler) |
protected abstract void |
registerQueueListener(String queue,
MessagingBrokerQueueListener listener)
Registers the
MessagingBrokerQueueListener implementation to the specified queue of
the message broker. |
protected abstract void |
removeQueue(String name)
Request the broker for queue deletion with all its subscriptions.
|
protected void |
sendMessageEvent(TopicMessageEventContext context) |
protected String |
toFullyQualifiedQueueName(MessageQueue queue)
Translates the queue name corresponding the broker queue name specification.
|
protected String |
toFullyQualifiedTopicName(String topic)
Translates the given topic definition to the broker environment specific name (in the enterprise
messaging this could be extended by the client name space)
|
protected String |
toTopicName(com.sap.cds.reflect.CdsEvent event)
Translates the specified CDS event into the broker topic structure.
|
after, after, before, before, getDelegatedService, getName, onprotected final CdsProperties.Messaging.MessagingServiceConfig serviceConfig
protected final CdsRuntime runtime
protected final MessageQueue queue
protected AbstractMessagingService(CdsProperties.Messaging.MessagingServiceConfig serviceConfig, CdsRuntime runtime)
public void init()
protected boolean createOrUpdateQueuesAndSubscriptions()
public void emit(EventContext context)
emit in interface Serviceemit in class ServiceDelegatorpublic void emit(String topic, String message)
emit in interface MessagingServicepublic void emit(String topic, Map<String,Object> message)
emit in interface MessagingService@HandlerOrder(value=-9900) protected void sendMessageEvent(TopicMessageEventContext context)
public void on(String[] events, String[] entities, int order, Handler handler)
on in interface Serviceon in class ServiceDelegatorprotected String toTopicName(com.sap.cds.reflect.CdsEvent event)
event - CDS declared eventprotected String toFullyQualifiedQueueName(MessageQueue queue)
queue - queue specificationprotected String toFullyQualifiedTopicName(String topic)
topic - broker specific topic definitionprotected abstract void removeQueue(String name) throws IOException
name - queue nameIOException - In case an error occurs while creating the queueprotected abstract void createQueue(String name, Map<String,String> properties) throws IOException
name - queue nameproperties - queue configuration propertiesIOException - In case an error occurs while creating the queueprotected abstract void createQueueSubscription(String queue, String topic) throws IOException
true
only when the queue topic subscription was successfully created or already available.
Otherwise false is returned.queue - the queue nametopic - the topic the queue should subscribe toIOException - In case an error occurs during the subscriptionprotected abstract void registerQueueListener(String queue, MessagingBrokerQueueListener listener) throws IOException
MessagingBrokerQueueListener implementation to the specified queue of
the message broker.queue - the queue namelistener - implementation of the MessagingBrokerQueueListener interfaceIOException - In case when any errors occurs while registering the listener to the brokerCopyright © 2021. All rights reserved.