2

I need to find a way to add an origin value in the custom header and then retrieve a custom header in the rabbit message header. Ideally, we should have it this way.

So far, I didn't have any success trying to find a way to do this.

Exchange    Test.Exchange
Routing Key Test.Exchange.7752275b-2323-42bf-98a4
Redelivered ●
Properties  user_id:fc4c-4d9c-9e4e-ad881040d0c1
type:   Events.Exchange
message_id: b2aff0d2-c8f4-4627-9826-089799bab344
delivery_mode:  2
headers:    global_execution_id:    7752275b-2323-42bf-98a4-ba7a8b96f2de
sent:   2019-04-30T13:54:24.4098945Z
**origin:   Test_Origin**

content_encoding:   UTF-8
content_type:   application/json

Payload30 bytesEncoding: string {"$id":"2","tenantId":"3456"}
1
  • Why storing an origin as a part of the message is not an option? It would make processing simpler and straightforward. Commented Jul 26, 2019 at 11:36

1 Answer 1

3

Directly from the tutorial:

In the following example, we publish a message with custom headers:

byte[] messageBodyBytes = System.Text.Encoding.UTF8.GetBytes("Hello, world!");

IBasicProperties props = model.CreateBasicProperties();
props.ContentType = "text/plain";
props.DeliveryMode = 2;
props.Headers = new Dictionary<string, object>();
props.Headers.Add("latitude",  51.5252949);
props.Headers.Add("longitude", -0.0905493);

model.BasicPublish(exchangeName,
                   routingKey, props,
                   messageBodyBytes);
Sign up to request clarification or add additional context in comments.

1 Comment

The question is about RawRabbit package

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.