--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/53a874f3-f01e-4b0c-9bc1-b14e2f5518da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You could put the consumer behavior in a separate class that is used by both the batch and the single message consumer. That way, the consumer construct (which is very similar to a web api controller) is separated from the actual message processing behavior. Then each consume method just calls the class with the per-message behavior.
On Fri, Aug 28, 2015 at 6:42 AM, Egor Chikunov <chikun...@gmail.com> wrote:
Hello, everyone!I'm trying to implement couple things and need an advice about masstransit-y way to do that.1. In 2 version there was IConsume<>.All interface that allowed to have Consume methods without ConsumeContext<> parameter.How can I achieve same behavior in 3 version? The reason is simple: I've got batch messages, that can contain multiple messages. At the same time messages may come one by one.So in case of the batch I'm just calling consumer methods manually, passing appropriate child messages from the batch.2. I'm going to implement message reordering and dependency checking (for instance, message from one source should be processed after the message from other source).What is the best place to extend masstransit to achieve that?3. What's the recommended way to use sagas in mt3? Using MassTransitStateMachine?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
That was my first idea. But that way I'll end up with a lot of consume methods looking just the same - get message from consumecontext and pass it to processor
пятница, 28 августа 2015 г., 18:00:22 UTC+3 пользователь Chris Patterson написал:
You could put the consumer behavior in a separate class that is used by both the batch and the single message consumer. That way, the consumer construct (which is very similar to a web api controller) is separated from the actual message processing behavior. Then each consume method just calls the class with the per-message behavior.
On Fri, Aug 28, 2015 at 6:42 AM, Egor Chikunov <chikun...@gmail.com> wrote:
Hello, everyone!I'm trying to implement couple things and need an advice about masstransit-y way to do that.1. In 2 version there was IConsume<>.All interface that allowed to have Consume methods without ConsumeContext<> parameter.How can I achieve same behavior in 3 version? The reason is simple: I've got batch messages, that can contain multiple messages. At the same time messages may come one by one.So in case of the batch I'm just calling consumer methods manually, passing appropriate child messages from the batch.2. I'm going to implement message reordering and dependency checking (for instance, message from one source should be processed after the message from other source).What is the best place to extend masstransit to achieve that?3. What's the recommended way to use sagas in mt3? Using MassTransitStateMachine?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/53a874f3-f01e-4b0c-9bc1-b14e2f5518da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/4bac2dbb-6511-4de4-830f-232d283edf4f%40googlegroups.com.
internal class StorageCommandsHandler :
IConsumer<CreateStorage>,
IConsumer<EnableStorage>,
IConsumer<DisableStorage>
{
public Task Consume(IConsumeContext<CreateStorage> message)
{
var command = message.Message;
Process(command);
return Task.FromResult(0);
}
public Task Consume(IConsumeContext<DisableStorage> message)
{
var command = message.Message;
Process(command);
return Task.FromResult(0);
}
public Task Consume(IConsumeContext<EnableStorage> message)
{
var command = message.Message;
Process(command);
return Task.FromResult(0);
}
public void Process(CreateStorage)
{
// Do actual stuff
}
public void Process(EnableStorage)
{
// Do actual stuff
}
public void Process(DisableStorage)
{
// Do actual stuff
}
}
Would you not expect to unit test the behavior of the consumer outside of actually sending it as a message?I guess you could just have two Consume() methods in your consumer (one for single, one for batch) and then have a private method ConsumeMessage(ConsumeContext context, TMessage message) that is called for each individual message.
On Fri, Aug 28, 2015 at 8:21 AM, Egor Chikunov <chikun...@gmail.com> wrote:
That was my first idea. But that way I'll end up with a lot of consume methods looking just the same - get message from consumecontext and pass it to processor
пятница, 28 августа 2015 г., 18:00:22 UTC+3 пользователь Chris Patterson написал:
You could put the consumer behavior in a separate class that is used by both the batch and the single message consumer. That way, the consumer construct (which is very similar to a web api controller) is separated from the actual message processing behavior. Then each consume method just calls the class with the per-message behavior.
On Fri, Aug 28, 2015 at 6:42 AM, Egor Chikunov <chikun...@gmail.com> wrote:
Hello, everyone!I'm trying to implement couple things and need an advice about masstransit-y way to do that.1. In 2 version there was IConsume<>.All interface that allowed to have Consume methods without ConsumeContext<> parameter.How can I achieve same behavior in 3 version? The reason is simple: I've got batch messages, that can contain multiple messages. At the same time messages may come one by one.So in case of the batch I'm just calling consumer methods manually, passing appropriate child messages from the batch.2. I'm going to implement message reordering and dependency checking (for instance, message from one source should be processed after the message from other source).What is the best place to extend masstransit to achieve that?3. What's the recommended way to use sagas in mt3? Using MassTransitStateMachine?
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/53a874f3-f01e-4b0c-9bc1-b14e2f5518da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.