Coder Social home page Coder Social logo

Comments (3)

GeraldLx avatar GeraldLx commented on June 18, 2024

Basically when you send a message to RabbitMQ you have some properties for this message and a payload. One of the properties is the correlation_id.

EasyNetQ, as the name shows, tries to simplify your life. So when you send a message (via a class), then it creates a RabbitMQ message with the serialized message as payload. While doing this it also generates a CorrelationId to give this message some kind of unique identifier, (The default implemantion is just Guid.NewGuid().ToString(), but you can replace it)

More or less this happens behind the scenes without any interaction necessary:
bus.SendReceive.Send(myMessage)

from easynetq.

shashankvivek avatar shashankvivek commented on June 18, 2024

@GeraldLx : Many thanks for your reply. How can we create this CreateBasicProperties() of EasyNetQ so that I override the default behavior and our correlationId.

from easynetq.

GeraldLx avatar GeraldLx commented on June 18, 2024

EasyNetQ has now many years of development behind, so there are a view ways to achieve this.

There is an interface ICorrelationIdGenerationStrategy which has one method GetCorrelationId. Just make your own version and register it in the DI when creating the bus.

You can also go over the Advanced bus. By going this route you are on a way deeper level where you have full control about the generated message. This way you can generate the properties manually and set the CorrelationId while sending.

You can also combine these. The logic behind the scenes is that EasyNetQ checks, if the correlation id was set otherwise it fills the correlation id with the value provided by the generation strategy.

from easynetq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.