I see your workaround and well.. yeah.. since we have multiple
them directly from the unit test. This will do it for the time being.
On Apr 23, 4:43 pm, Urs Enzler <
urs.enz...@gmail.com> wrote:
> Hi Xavi
>
> There is a way - it's ugly but it works :-)
>
> The idea is to use an extension that cancels message enqueue and directly
> executes the handler method with the message.
>
> Add an extension to the async module with the following handler for the
> event BeforeEnqueueMessage
>
> private void ModuleControllerOnBeforeEnqueueMessage(object sender, EnqueueMessageEventArgs enqueueMessageEventArgs)
> {
> enqueueMessageEventArgs.Cancel = true;
>
> MethodInfo method = null;
>
> foreach (MethodInfo methodInfo in enqueueMessageEventArgs.Module.GetType().GetMethods())
> {
> if (Attribute.IsDefined(methodInfo, typeof(MessageConsumerAttribute), true))
> {
> method = methodInfo;
> }
> }
>
> method.Invoke(enqueueMessageEventArgs.Module, new[] { enqueueMessageEventArgs.Message });
> }
>
> Note that this works only if there is a single message consumer method.
> Otherwise, you have to add a bit more logic.
>