Developer Quick Start
This page shows you the fastest way to send and receive DREX-M messages in three different scenarios:
.NET ― official Service-Bus library
Java ― official Service-Bus library
Any other language ― plain RabbitMQ client
All samples assume you have completed the Quick Checklist and obtained valid credentials.
Using the .NET Service-Bus Library
Install the NuGet packages (internal ABS Wavesight feed):
dotnet add package Abs.CommonCore.ServiceBusLib
dotnet add package Abs.CommonCore.ServiceBusLib.RabbitMq
// Connection ----------------------------------------------------------
RmqConnectionParams connParams = new() { ConnectionString = "amqps://fleet.analytics:your_password@rabbitmq-central:5671/commoncore" };
await using RmqConnection connection = new()
{
ConnectionParams = connParams,
InputMarshaller = new RmqInputMessageMarshaller(),
OutputMarshaller = new RmqOutputMessageMarshaller()
};
await connection.StartAsync();
// Listener ------------------------------------------------------------
await using SimpleProcessor directProcessor = new();
var listener = await connection.NewListenerAsync(
"direct-listener",
new RmqSourceParams
{
SourceConnectionType = RmqConnectionType.QUEUE,
SourceQueueOrExchange =
"q.cc.drex.inbox.direct.adapter.fleet.analytics"
},
directProcessor);
await listener.StartAsync();
// Publisher -----------------------------------------------------------
byte[] body = Encoding.UTF8.GetBytes("hello world");
var populator = new MessagePopulator
{
SourceSite = new Site(null, SiteType.CLOUD),
SourceApp = new Application(null, "fleet.analytics"),
TargetSite = new Site(null, SiteType.CLOUD),
TargetApp = new Application(null, "maintenance.scheduler"),
TimeToLive = TimeSpan.FromSeconds(30),
Scope = Scope.LINEAR,
};
var msg = new Message { BodyBuffer = new ReadOnlyMemory<byte>(body) };
populator.Initialize(msg);
var publisher = connection.NewPublisher(
"portal-publisher",
new RmqTargetParams
{
TargetConnectionType = RmqConnectionType.EXCHANGE,
TargetQueueOrExchange = "e.cc.drex.portal"
});
await publisher.PublishAsync(msg);
Create a connection, listener, and publisher:
Using the Java Service-Bus Library
<dependency>
<groupId>com.abs.cc.servicebuslib</groupId>
<artifactId>servicebuslib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.abs.cc.servicebuslib</groupId>
<artifactId>servicebuslib-rabbitmq</artifactId>
<version>1.0.0</version>
</dependency>
Add the dependency to your pom.xml:
Using Any Other RabbitMQ Client
If you prefer Python, Go, Node, etc., the only requirement is to set the mandatory headers.
See Message Headers Reference for the full list.