cloudevents / cloudevents/sdk-csharp
AMQP Rabbit
Open
@jskeet is already working on this.
Since Aug 17, 2022.
question
- Dominant language
- C#
- Stars
- 334
- Forks
- 88
- Avg merge
- 7m
- Merged PRs (30d)
- 2
Description
Hi,
Can you please provide an example/documentation how to dispatch and consume a message to and from rabbitMQ using ToAmqpMessage() ?
var formatter = new JsonEventFormatter();
var message = cloudEvent.ToAmqpMessage(ContentMode.Binary, formatter);
var encoded = message.Encode();
//This message is then published to rabbit
Consumer
// Reading the message
Task<bool> MessageProcessor(BasicDeliverEventArgs eventArgs)
{
var formatter = new JsonEventFormatter();
var byteBuffer = new ByteBuffer(eventArgs.Body.ToArray(), 0, eventArgs.Body.Length, eventArgs.Body.Length);
var message = Message.Decode(byteBuffer);
var cloudEvent = message.ToCloudEvent(formatter);
// also tried
var byteBuffer = JsonSerializer.Deserialize<ByteBuffer>(eventArgs.Body.ToArray());
var message1 = Message.Decode(byteBuffer);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.