Sending data to remote queues
Scoring.one provides API for sending data to remote systems via queue directly from scenarios. There are pre-defined queues dedicated to sending data to RDBMS (i.e. „sce-postgres-data”)
Example in Groovy:
import com.rabbitmq.client.*
amqpManager.checkConnection()
if (!amqpManager.channelExists(chName)) {
amqpManager.createChannel(chName)
}
amqpManager.publish(chName, JsonOutput.toJson(BEnvelope),[eventGroup: BEnvelope['eventGroup']])Where arguments of publish method are:
chName – rabbitMQ's channel name (String)
JsonOutput.toJson(BEnvelope) – message content (String)
[eventGroup: BEnvelope['eventGroup']] – message headers (Map<String, Object>); this argument is optional and may be omitted
The full definition of the publish method, including overloaded variants:
void publish(String channelName, String channelMsg)
void publish(String channelName, String channelMsg, Map<String, Object> headers)
void publish(String channelName, String channelMsg, boolean waitForConfirms, Map<String, Object> headers)Where:
channelName – the name of the RabbitMQ channel created by createChannel(channelName)
channelMsg – the message body
waitForConfirms – whether to wait until all messages published since the last call have been either ack'd or nack'd by the broker
headers – a user-defined map of key-value pairs used to attach custom metadata to the message. These headers can be used by consumers or routing logic to inspect, filter, or process messages based on application-specific information. Each key must be a string, and the values can be of various AMQP-compatible types (e.g., String, Integer, Boolean, byte[])
A message intended for persistence in a relational database should be a JSON object with the structure described as follows:
Example:
Last updated