masstransit

Adding values to header in MassTransit.RabbitMq

旧街凉风 提交于 2020-01-03 09:07:15
问题 I am using MassTransit 3.0.0.0 and I have a hard time understanding how to intercept messages in a Request-Response scenario on their way out and add some information to the headers field that I can read on the receiver's end. I was looking at the Middleware, as recommended in the MassTransit docs - see Observers warning - but the context you get on the Send is just a Pipe context that doesn't have access to the Headers field so I cannot alter it. I used the sample provided in Middleware page

Updating the steps in Saga

ε祈祈猫儿з 提交于 2019-12-25 12:33:07
问题 I am looking for a way to change the steps in the saga, example: insert a step during the processing, preferablly during runtime Is it possible to do using sagas? 回答1: Sagas (particularly those written using Automatonymous) were not designed to handle dynamic configuration at runtime. They are a codified way to create process monitors and workflows. If you need to dynamically modify the steps of a workflow, you could use the Courier routing slip, which is built into MassTransit. It allows an

RabbitMQ. Masstransit. Virtual Hosts.

天大地大妈咪最大 提交于 2019-12-25 09:42:25
问题 how can I create virtual host from masstransit service bus configuration? I mean, for example, I deployed my app to some new PC and it should create new virtual host for itself. I'm trying do this like this: var bus = ServiceBusFactory.New(sbc => { sbc.UseRabbitMq(); sbc.UseHealthMonitoring(10); sbc.ReceiveFrom("rabbitmq://localhost:5672/mynewcustomvhost/myqueue?temporary=true"); }); But getting error: "No Obvious Problems says ConfigurationResult" Why so? 回答1: Try this: ServiceBusFactory.New

MassTransit: Message contracts, polymorphism and dynamic proxy objects

喜夏-厌秋 提交于 2019-12-25 04:18:09
问题 TL;DR On contract subscription, how can I get the raw message content or the original published object, rather than a dynamic proxy? I am having a bad time trying to create a modular application based on MassTransit. My idea is to have a Websocket server connected to queue, it reads events from the socket and inserts it in the queue as a "connection request", and reads events from the queue and send them to the sockets as "connection events". Both have a contract that allows the WS server

MassTransit - subscribing to all fault events on Azure Service Bus

冷暖自知 提交于 2019-12-25 03:21:26
问题 I'm aware of a similar post here but don't have enough rep to comment and ask for clarification. I've been trying to achieve a similar thing as the accepted answer suggests, with one service on Azure Service Bus capturing all Fault events, but can't see any events of type Fault being published. This is how I'm subscribed: Bus.Factory.CreateUsingAzureServiceBus( sbc => { var host = ConfigureServiceBus(serviceBusPath, sbc); sbc.SubscriptionEndpoint<Fault>(host, subscriptionName, ec => { ec

Access objects within a Consumer

[亡魂溺海] 提交于 2019-12-24 07:26:41
问题 I am working on a project that consumes messages using MassTransit and RabbitMQ in C# I'm building a prototype and right now the consumer project is a console application. Within the Main program.cs class, I connect to the bus and subscribe to accept messages from the publisher like this: var bus = BusInitializer.CreateBus("Subscriber", x => { x.Subscribe(subs => { subs.Consumer<UpdatedInformation>().Permanent(); }); }); For reference, here's the CreateBus() method: public static IServiceBus

Why is it not recommended to host receive endpoints in a web application using MassTransit?

隐身守侯 提交于 2019-12-24 01:53:53
问题 I am working on an ASP.NET MVC 5 application (based on nopCommerce). I want to use MassTransit to communicate with another application that is used for inventory management, billing, etc. It would be easier if I could add receive endpoints directly into the web application and not have to create a Windows service for that. But the MassTransit documentation says it is not recommended and there is no explanation as to why that is. MassTransit in a web application Configuring a bus in a web site

How to get size (number of messages) of a MassTransit IBus?

做~自己de王妃 提交于 2019-12-24 01:16:49
问题 I'm using the MassTransit library's InMemoryMessageBus and I would like to know how I can get the number of messages in the queue (the size of the bus). 回答1: The number of messages in any particular queue using the in-memory transport is not available. The message delivery is based on a queued task scheduler, and the message counts have not been made available. I'm not sure if they could be or not (well, easily. Anything is possible, but practical is another matter). UPDATE: This was added to

Obtain dynamic object in MassTransit consumer

 ̄綄美尐妖づ 提交于 2019-12-24 00:44:44
问题 We use an empty marker interface for a group of events that need to be saved to some audit log database. However, in the consumer, messages are cast to this interface, so we get an empty object. What we actually need is to get the "dynamic" or get hold on the message body so we can send it to the audit database "as-is" since our database can save JSON documents. But we cannot see how we can get the message body as JSON from the context. Is it possible at all? 回答1: If you really wanted to be

How to write MassTransitStateMachine unit tests?

穿精又带淫゛_ 提交于 2019-12-23 23:05:48
问题 I'm finally starting to leverage the excellent Automatonymous components within MassTransit, and I'd like to TDD my way through my new state machines. After reading over the MT docs here (http://masstransit-project.com/MassTransit/advanced/sagas/automatonymous.html) and spending some time Googling, I found unit tests right in the MT/Automatonymous Git repo that looked like the way to go: https://github.com/MassTransit/Automatonymous/blob/master/src/Automatonymous.Tests/Condition_Specs.cs#L21