Triggering wait for event in process flow using sendmessage()

Triggering wait for event in process flow using sendmessage()

rhramac
Enthusiast Enthusiast
261 Views
12 Replies
Message 1 of 13

Triggering wait for event in process flow using sendmessage()

rhramac
Enthusiast
Enthusiast

[ FlexSim 21.2.4 ]

Is there a way to trigger wait for event activity in process flow from using sendmessage()?


sendmsg.fsm

0 Likes
Accepted solutions (1)
262 Views
12 Replies
Replies (12)
Message 2 of 13

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

I think, it is more likely the on receive message event, that you can evaluate.

0 Likes
Message 3 of 13

jason_lightfootVL7B4
Autodesk
Autodesk

In you case you can just detect that a token enters/exits the activity: "Custom Code- Send message"

0 Likes
Message 4 of 13

rhramac
Enthusiast
Enthusiast

Hi Jason, Thanks for your response. I asked this as part of bigger model where I use a customized library in flexsim. I add instruction to travel, and then instruction to send message, so that the message is triggered after travel is completed. So detecting token entry exit to custom code will not help.


1651978624945.png



0 Likes
Message 5 of 13

rhramac
Enthusiast
Enthusiast
Hi Joerg, can you explain it a bit?
0 Likes
Message 6 of 13

jason_lightfootVL7B4
Autodesk
Autodesk
The OnMessage event is common on the objects and a wait for event activity, when you sample an object that has the event, will offer OnMessage as the triggering event. This is not the sending of the message but the receiving.
0 Likes
Message 7 of 13

rhramac
Enthusiast
Enthusiast
So can a wait for event activity listen to itself, if there is a message being passed to it or can it listen to only 3D objects
0 Likes
Message 8 of 13

jason_lightfootVL7B4
Autodesk
Autodesk

Doesn't look like it from either the dropdown list you get when you sample it, or a simple test.

I think pushing to and pulling from lists are a much better option for synchronization like this - so much more transparent.

0 Likes
Message 9 of 13

rhramac
Enthusiast
Enthusiast
I was able to send message to queue and use wait for event to listen to it. Since the send message has only double parameter. I send passed an object with all details in the fromObject argument. Thanks to @Logan Gold for walking me through the process.
0 Likes
Message 10 of 13

jason_lightfootVL7B4
Autodesk
Autodesk

Glad you were able to articulate what you were looking for with Logan. You're still not detecting the message sending event unless it's sent and received in zero time. If it's a delayed message then you'll not be able to detect the sending event

0 Likes
Message 11 of 13

rhramac
Enthusiast
Enthusiast
In my case I am sending regular sendmessage() and not delayed. Can you please elaborate why it would not work for a delayed message? Curious.
0 Likes
Message 12 of 13

jason_lightfootVL7B4
Autodesk
Autodesk
You're detecting the receiving of the message, not the sending of it. So if the message is delayed by n seconds you're not going to know when it was sent unless you also pass that as a parameter.
0 Likes
Message 13 of 13

rhramac
Enthusiast
Enthusiast
Makes sense. Thanks for the explanation.
0 Likes