Re: [masstransit-discuss] Automatonymous state machine with "The message cannot be accepted by an existing saga" exceptions

142 views
Skip to first unread message
Message has been deleted

Chris Patterson

unread,
Jun 17, 2013, 6:41:00 PM6/17/13
to masstrans...@googlegroups.com
Can you post the machine transitions?


On Mon, Jun 17, 2013 at 3:32 PM, Maor Hayoun <maor....@gmail.com> wrote:

Hi,

I've had some experience with the Magnum state machine which works great with masstransit.

but I saw that the Automatonymous state machine is the most recent project between the 2 and so i tried it.

I've given it few hours of experimenting, overcame few bumps along the way, but eventually reached a "brick-wall" - which could be a bug or misuse by me.


I've attached my state machine definitions below. note that the states and events declarations are built using compiled expression at runtime (so this is not the issue).



i'm currently getting "The message cannot be accepted by an existing saga" exception which is fired by InitiatingSagaPolicy class for PushNotificationRequest .
I'm trying to figure out the machine flow, but it seems this happens since InitiatingSagaPolicy is assigned to handle this message type. 
all because of this line
  IEnumerable<State> states =
                    _stateMachine.States.Where(state => _stateMachine.NextEvents(state).Contains(@event));

at StateMachineConnector class, which returns only the initial state - since it's the only state that its next states are EvaluateRequest.
Note that i'm doing something that worked without any problem with magnum - at the initalizeSaga method i'm publishing the next message in the machine,
thus - advancing the machine's state myself (rather than waiting for external message to be received.
 the mentioned method looks like this:

        public void InitializeSaga(PushSagaEntity entityPushNotificationRequest msg)
        {
 
            entity.MessageId = msg.MessageId;
            entity.AppId = msg.AppId;
            entity.Originator = msg.Originator;
            entity.CreatedDate = entity.UpdatedDate = msg.Timestamp;
            entity.DeviceType = msg.DeviceType;
            entity.Message = msg.Message;
            entity.BadgeCount = msg.Badge;
            entity.PushData = msg.PushData;
     
 
 
            Bus.Publish<PushNotificationRequestEvaluation>(m =>
                {
                    m.CorrelationId = msg.CorrelationId;
                    m.MessageId = msg.MessageId;
                    m.AppId = msg.AppId;
                    m.Originator = msg.Originator;
                    m.Timestamp = msg.Timestamp;
                    m.DeviceType = msg.DeviceType;
                    m.Message = msg.Message;
                    m.Badge = msg.Badge;
                    m.PushData = msg.PushData;
                    m.Range = msg.Range;
                });
        }

additional info:
  • when removing the publish call in InitializeSaga method - machine work ok (although i'm stuck at initial state)
  • when uncommenting the DuringAny call in machine declaration enters the machine into infinite loop calls to InitializeSaga method
I'm think to fallback to the regular Magnum machine, but would really like to keep my current work with Automatonymous 
thanks in advance

Maor

--
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/496de601-4fcd-4bc4-a6e1-647f447f3864%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Message has been deleted
Message has been deleted

Maor Hayoun

unread,
Jun 18, 2013, 6:03:25 AM6/18/13
to masstrans...@googlegroups.com
never mind, found the problem. thanks
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

Chris Patterson

unread,
Jun 18, 2013, 11:15:59 AM6/18/13
to masstrans...@googlegroups.com
What was the issue? Is there something we can update in the documentation to make it easier to understand?


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.

Maor Hayoun

unread,
Jun 23, 2013, 1:13:54 PM6/23/13
to masstrans...@googlegroups.com
Something to do with inheritance model of messages,
it's all ok when you use a base message for all your messages in your state machine (just to lay out the shared properties to every state you encounter), and derive from it for every state message.
like this :

|_ B
|_ C
...

but when you derive a state message and then derive from it again for another state - like this:
A
|_B
   |_ C

 things go very wrong :)

since the exchange is bound to all types of messages in the inheritance model, the first "concrete" message (B) is consumed,
and then when you attempt to publish a "C" message to be consumed by its "C State", you reach once again to B related state, and again - infinite times.
It never reaches to C state.

So this one is on me :)
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.

--
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.
Reply all
Reply to author
Forward
0 new messages