-
Notifications
You must be signed in to change notification settings - Fork 148
Documentation to work with Activemq Artemis #286
Copy link
Copy link
Open
Labels
InfoUseful informationUseful information
Description
The standard HelloWorld sample works in multiple Amqp 1.0 brokers, I had some issues using Activemq Artemis. It was caused by artemis standard auto-creation feature. all-defaults it will create topics. When you want to work with queues you need to specify it in either broker.xml, or you can set it using Capabilities, see below. Might be good to document how to work with different brokers.
public class SimpleAmqpTest
{
[Fact]
public async Task TestHelloWorld()
{
Address address = new Address("amqp://guest:guest@localhost:5672");
Connection connection = await Connection.Factory.CreateAsync(address);
Session session = new Session(connection);
Message message = new Message("Hello AMQP");
Target target = new Target
{
Address = "q1",
Capabilities = new Symbol[] { new Symbol("queue") }
};
SenderLink sender = new SenderLink(session, "sender-link", target, null);
await sender.SendAsync(message);
Source source = new Source
{
Address = "q1",
Capabilities = new Symbol[] { new Symbol("queue") }
};
ReceiverLink receiver = new ReceiverLink(session, "receiver-link", source, null);
message = await receiver.ReceiveAsync();
receiver.Accept(message);
await sender.CloseAsync();
await receiver.CloseAsync();
await session.CloseAsync();
await connection.CloseAsync();
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
InfoUseful informationUseful information