masstransit

How to successfully drive a MassTransitStateMachine via the InMemoryTestHarness?

佐手、 提交于 2019-12-14 04:27:12
问题 Following up to: How to write MassTransitStateMachine unit tests? Here's a simple test class (using MS Test) for a simple state machine called ProcedureStateMachine (note: this is not a real production state machine for us... just an experiment I'd used to play around with MassTransitStateMachine a while back.. it seemed a handy self-contained place to experiment with getting unit testing going too): [TestClass] public class ProcedureStateMachineTests { private ProcedureStateMachine _machine;

Why are structs not allowed in MassTransit messaging?

扶醉桌前 提交于 2019-12-14 01:45:21
问题 The consumer interfaces in MassTransit all expect the message models to be classes and not structs. Since they are all inner interfaces (very nice design there I must say), this is the generic container class showing the constraint, taken directly from the source code: /// <summary> /// Declares a Consume method for the message type TMessage which is called /// whenever a a message is received of the specified type. /// </summary> public static class Consumes<TMessage> where TMessage : class

MassTransit: is there a way to log income messages

二次信任 提交于 2019-12-13 16:48:46
问题 I'd like to log every message that i consume in MassTransit. Is there a way to implement global interceptor where i could handle income message or achieve that using configuration? My current config looks like this: BusFactory = Bus.Factory.CreateUsingRabbitMq(cfg => { var host = cfg.Host(new Uri(AppSettings.RmqConnectionString), h => { }); cfg.UseNLog(); cfg.ReceiveEndpoint(host, RmqPropertyKeys.CallbackQueue, e=> e.LoadFrom(container)); }); 回答1: The documentation includes an example

MassTransit and MaxConcurrentCalls not behaving as expected?

旧城冷巷雨未停 提交于 2019-12-13 07:28:17
问题 I'm using MassTransit as my messaging framework, running on top of Azure Service Bus. I'm running MassTransit from inside a WebJob (although I don't think that matters) Now I'm trying to get MassTransit to process multiple messages at the same time, as I'm now dealing with messages that individually take a while to process. So to speed up performance, I don't want each message to be processed one by one. I tried setting MaxConcurrentCalls to , for example, 30, but that doesn't seem to do it.

Prevent MassTransit from creating a RabbitMQ exchange for a consumer host

我的未来我决定 提交于 2019-12-13 03:49:53
问题 Is it possible to configure MassTransit to not create a RabbitMQ exchange for a consumer host? My RabbitMQ user has not enough rights to declare an exchange at the host where the consuming queue is located, so MassTransit fails to start with the following error: Unhandled Exception: MassTransit.RabbitMqTransport.RabbitMqConnectionException: Operation interrupted ---> RabbitMQ.Client.Exceptions.OperationInterruptedExcept ion: The AMQP operation was interrupted: AMQP close-reason, initiated by

MassTransit3 how to make request from consumer

我与影子孤独终老i 提交于 2019-12-13 01:28:45
问题 I want to make a req/res request from IConsumer.Consume() method, but I don't see any method on ConsumeContext<> that returns a reference to IRequestClient<,> . Do I need to hold a reference to IBusControl somewhere and use it or I can use context somehow? 回答1: In this case, it is best to create the request client outside of the consumer and pass it as a dependency to the consumer as an IRequestClient<,> interface. The request client is created with IBus , which is outside of the consumer

Windsor composite lifestyle for asp.net process

浪子不回头ぞ 提交于 2019-12-12 19:25:17
问题 I have an asp.net process which also consumes messages from a servicebus (MassTransit). For webrequests my database session is resolved with a PerWebRequest lifestyle. But when the process consumes a message from MassTransit I need the database session to have another lifestyle, as no HttpContext is available. I have made this: public class PerRequestLifeStyleManager : ILifestyleManager { readonly PerWebRequestLifestyleManager perWebRequestLifestyleManager; readonly PerThreadLifestyleManager

Masstransit and RabbitMQ - how many consumers are connected

时光怂恿深爱的人放手 提交于 2019-12-12 19:18:06
问题 I am using MassTransit and RabbitMQ in both a "competing consumers" model and a Pub/Sub model. 3 tiers, 1st tier = UI, 2nd tier = gateway, 3rd tier = many distributed services I have a working competing consumers model but I wish to do the following with Pub/Sub: The gateway service publishes a message that all connected subscriber instances consume and then respond to to the gateway. The gateway doesn't respond to the UI until all its 3rd tier have responded, the gateway accumulates the

Does MassTransit Request/Response need common .dll's in microservice architecture?

陌路散爱 提交于 2019-12-12 19:07:59
问题 I am going to implement my app in .Net Core, using RabbitMQ and MassTransit in Request/Response pattern. Here is the code for receiver (it receives the username and password and then sends the username and a provider key to the client): //BusConfiguration.cs public static IBusControl ConfigureBus( Action<IRabbitMqBusFactoryConfigurator, IRabbitMqHost> registrationAction = null) { return Bus.Factory.CreateUsingRabbitMq(cfg => { var host = cfg.Host(new Uri(RabbitMqConstants.RabbitMqUri), hst =>

Distributed transaction with MSMQ and SQL Server but sometimes getting dirty reads

為{幸葍}努か 提交于 2019-12-12 18:36:07
问题 Our SQL Server 2014 database is set to READ_COMMITTED_SNAPSHOT . We use MSMQ and distributed transactions (we use MassTransit 2.10) In one part of our system we read a message from the queue, make database updates and then publish a new message to the queue (all under a single transaction). We have found a situation where it seems that the update are not committed when the next message is processed (it reads from the same table the first part updates) even though I would expect that message