bgapi commands are asynchronous that means when you send the command it spawns a thread and runs in the background. When its complete it will send you the event, its completely dependent on how long the task takes that you asked it to run. Its no different that doing 12 wgets to a website in the bg, there is no telling when they will be done. 2011/2/24 Mauritz Løvgren <mauritz.lovgren@hotmail.com>:
The use case is as follows;
Multi-threaded Java applicaton that sends bgapi commands to several channels in parallel over the same ESL connection. (bgapi commands are serialized in order to the socket outputstream, but is there any guarantee that we will receive the OK / ERR reply for each bgapi in the correct order from the socket inputstream?)
And, what about sending bgapi commands on the same socket while a ‘regular’ api command is currently executing? I suspect the bgapi reply will delay until the ‘regular’ (blocking) api command is finished processing?
- Mauritz
From: Michael Collins Sent: Thursday, February 24, 2011 9:44 PM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Receive order guarantee for bgapi command replies over ESL?
Just curious - what is the use case where sending a stack of bgapi's without listening for the reply is more desirable than looping through the bgapi send/reply sequence for each one? I'm no super programmer but it seems to me that blindly relying on another system to always send stuff in the exact correct order is dangerous and may cause bugs that are difficult to diagnose. Personally I would consider it a programming best practice to wait for the response of the bgapi before sending another one.
I invite other socket programmers to give their input...
-MC
P.S - you may wish to disable the legal notice at the and of your emails when sending to a public list. (We know that some servers tag outgoing messages automatically and if that is your case we understand. Go yell at the I.T. guy! :)
2011/2/24 Mauritz Løvgren <mauritz.lovgren@hotmail.com>
Hi,
Are replies for bgapi commands sent back to an inbound socket connection in the same order as the commands were sent?
Example: sending 10 bgapi messages from client to freeswitch socket with no delay inbetween. Will the response for those command messages be sent back by freeswitch in the exact same order as their commands were received, or should one wait for each reply before sending a new bgapi command to be sure one gets a reply for the correct command?
If there was an option of providing a UUID (or sequenceId) for the command, it would be easier to match the reply with the request upon receival, but this doesn’t seem to be possible with the current implementation?
Regards, Mauritz Lovgren Systems Architect IPLink Inc.
________________________________ _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900