-
Hello, btw I’m using the hosting and DI nugets within this api |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I’ve found a workaround by injecting the ConnectionProvider and retrieving the connection by its name. This allows me to get a producer to send messages to the targeted queue. Are there any potential drawbacks to manually creating the producer? var message = new Message(messageBody);
var connection = await _connectionProvider.GetConnectionAsync("MyAppConnection");
var producer = await connection.CreateProducerAsync("a1", RoutingType.Anycast);
await producer.SendAsync(message); |
Beta Was this translation helpful? Give feedback.
-
Thank you for the feedback. As the library currently only handles AMQP, we may need to switch to another protocol in the future if required. Therefore, we wanted to decouple the code from the message delivery method to make it as easy as possible to swap the implementation in the future. Could you please clarify how the producer/session lifecycle is managed in this context? |
Beta Was this translation helpful? Give feedback.
-
Hello @Havret, I truly appreciate your responsiveness and the time you've dedicated to answering my questions. Regarding the solution, I ended up implementing something quite similar to your suggestions:
Thank you! |
Beta Was this translation helpful? Give feedback.
The ArtemisNetClient simplifies the AMQP API by eliminating the need for a session within the API. When you create a producer or consumer, each resource independently creates its own session, which is then retained as part of the producer or consumer objects, respectively.
As I mentioned in my previous response, AMQP resources are designed to be long-lived entities. Adhering to this best practice is relatively straightforward for console applications but can be challenging for web-based applications or applications that utilize dependency injection concepts in general. To properly use the library in these contexts, users must navigate a series of non-trivial decisions, such as how to regi…