masstransit

nServiceBus vs Mass Transit vs Rhino Service Bus vs other?

大兔子大兔子 提交于 2019-12-02 13:58:22
Just doing some quick spikes into possibly using a messaging system to process files that are in a nicely decoupled work flow system. What are the pro's and cons that people have found of using each of the above frameworks? What are the advantages of using these versus a hand-rolled MSMQ system with the WCF bindings and/or non-MSMQ solutions?? I'd recommend staying away from hand-rolled solutions as there is a bunch of somewhat difficult stuff that needs to be gotten just right - like how transactions are handled, how exceptions cause rollbacks, how to stop rolling back endlessly (poison

Get MassTransit message retries amount

烈酒焚心 提交于 2019-12-02 07:16:15
问题 I'm using Masstransit+RabbitMQ. One of the my consumers implements retry policy and I'm wondering if there any way to get message's retries amout once message is in the error queue? Also I would like to know how MT counting retries because I didn't namage to find any related information in message's headers using RabbitMq server. Thanks. 回答1: You can, in your consumer, use the following method to retry the retry attempt number. consumeContext.GetRetryAttempt() It should return > 0 if the

Get MassTransit message retries amount

。_饼干妹妹 提交于 2019-12-02 06:26:44
I'm using Masstransit+RabbitMQ. One of the my consumers implements retry policy and I'm wondering if there any way to get message's retries amout once message is in the error queue? Also I would like to know how MT counting retries because I didn't namage to find any related information in message's headers using RabbitMq server. Thanks. You can, in your consumer, use the following method to retry the retry attempt number. consumeContext.GetRetryAttempt() It should return > 0 if the current processing attempt is a retry. Once the retry limit is reached, the next version of MassTransit (v6)

How do I finalize a class based Saga, so that it is deleted from the SQL database (EF Core)?

断了今生、忘了曾经 提交于 2019-12-01 12:40:36
I am trying to learn more about Mass Transit as we are thinking about adopting it. I now have the class based Saga below, which works as expected: public class EchoSaga : ISaga, InitiatedBy<TextEntered>, Orchestrates<TextEchoStart>, Orchestrates<EchoEnd> { public Guid CorrelationId { get; set; } public string CurrentState { get; set; } public string Text { get; set; } public Task Consume(ConsumeContext<TextEntered> context) { CurrentState = "Entered"; Text = context.Message.Text; return Task.CompletedTask; } public Task Consume(ConsumeContext<TextEchoStart> context) { CurrentState = "Start";

How do I finalize a class based Saga, so that it is deleted from the SQL database (EF Core)?

烂漫一生 提交于 2019-12-01 11:41:42
问题 I am trying to learn more about Mass Transit as we are thinking about adopting it. I now have the class based Saga below, which works as expected: public class EchoSaga : ISaga, InitiatedBy<TextEntered>, Orchestrates<TextEchoStart>, Orchestrates<EchoEnd> { public Guid CorrelationId { get; set; } public string CurrentState { get; set; } public string Text { get; set; } public Task Consume(ConsumeContext<TextEntered> context) { CurrentState = "Entered"; Text = context.Message.Text; return Task

Handling transition to state for multiple events

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 05:58:16
I have a MassTransitStateMachine that orchestrates a process which involves creating multiple events. Once all of the events are done, I want the state to transition to a 'clean up' phase. Here is the relevant state declaration and filter function: During(ImportingData, When(DataImported) // When we get a data imported event, mark this source as done. .Then(MarkImportCompletedForLocation), When(DataImported, IsAllDataImported) // Once all are done, we can transition to cleaning up... .Then(CleanUpSources) .TransitionTo(CleaningUp) ); ...snip... private static bool IsAllDataImported

Disable round-robin pattern and use fanout on MassTransit

时光毁灭记忆、已成空白 提交于 2019-12-01 04:09:51
问题 I have created a basic demo pub/sub application which works on localhost with MassTransit. What I want to achieve is to publish a message and all the subscribers should receive the message. At the moment, in my environment I start one publisher app and two subscriber apps. But when I publish a message the subscribers receive the message in turns. I thought the fanout exchange type was default? But it applies the round-robin pattern. I added config.ExchangeType = ExchangeType.Fanout;

MassTransit: Adding Headers to Publish Pipeline

£可爱£侵袭症+ 提交于 2019-12-01 04:08:37
问题 I'm using MassTransit 3.2.4 and I'm trying to add some header information for to my published messages but the code to set the header never seems to run. I'm not sure why this doesn't work. var bus = Bus.Factory.CreateUsingRabbitMq(config => { var host = config.Host(new Uri("rabbitmq://localhost/"), h {}); config.ReceiveEndpoint(host, "TestPublisher", e => { e.ConfigurePublish(x => x.UseSendExecute(context => context.Headers.Set("HeaderKey", "HeaderValue") )); }); }); On the consumer end I'm

Multiple consumers for the same message through Unity not working in MassTransit

半城伤御伤魂 提交于 2019-11-30 20:46:10
I'm having a lot of problems lately because of what seems to be a bug in the MassTransit.UnityIntegration package, primarily due to the fact that registration names are not being considered. For instance, if I register my classes like this: var container = new UnityContainer() .RegisterType<Consumes<Command1>.All, Handler1>("Handler1") .RegisterType<Consumes<Command1>.All, Handler3>("Handler3"); A few lines later, I use the LoadFrom extension method to get the registered consumers in the container like this: IServiceBus massTransitBus = ServiceBusFactory.New(_sbc => { _sbc.UseBinarySerializer(

How to implement a saga using a scatter/Gather pattern In MassTransit 3.0

最后都变了- 提交于 2019-11-30 04:12:27
Jimmy Boagard describes a McDonalds fast food chain here comparing it to a scatter gather pattern. Workflow image stolen from above article: Initial Implementation Thoughts: To have a common interface for all of the types of FoodOrdered events that all of the food stations would get and then each food station would be able to consume/create its respective item and publish a common done event. Ex: fries and burger station gets a message regarding an order of Fries, The fries station consumes the order announces an ItemDoneEvent that the saga is listening for. Initial Concerns: Since the Saga