Author Topic: Asynchronous Programming with SDK  (Read 6759 times)

s.kulku

  • Guest
Asynchronous Programming with SDK
« on: May 02, 2007, 10:42:40 AM »
Ready the posts here I am relived that I'm not the only one killing myself with Genesys SDK. It also seems like Java is a de facto standard for using it.

I have a question about how to handle asynchronous events in Genesys such as EventRinging, EventQueued, etc.

The only mechanism available to send requests is response = protocol.request(message) and it works great for Dial command, Hold command and others. What needs to be done to get EventRinging? Can someone please show me a way to do it? Source is best! ;)
Sanja Kulku
Technical Product Manager




Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Asynchronous Programming with SDK
« Reply #1 on: May 02, 2007, 11:04:17 AM »
  • Best Answer
  • Sanja,

    great thing about this forum is that you can register to receive an email whenever a new post or a reply to the post is made. And, wow, here I am, replying to the post within ten minutes. Not bad :) I wonder if Genesys Support can bit that :) Look Ma, No Hands!!!!  :D

    Regarding your question about Asynchronous Programming, actually, after digging in a little bit more, I found that Genesys offers two types of ways to send request to TServer: REQUEST and SEND. Request is what I have been trying to use for the last few days, and I found it very fun to use, except for the fact that you never know what sort of reply you get. And of course, it cannot handle any sort of events :)

    So, once again, I decided to peruse through introduction to GSDK and Lo' and behold: Commons.Connection for Java was the answer. Beats me why it was there (Uhmmm, Introduction to Genesys SDK manual would be a fun thing to have - and if there is one out there, I guess I should have looked harder) and there is a section there talking about Solicited and Un-Soilicited Events. I remember just scrolling through the section because I thought it was just a basic: Request<->Event fundamentals, and then I found this:

    "Once you have created the request and set any required properties, you can continue in two different ways. You could send() the request and then wait for the response:....."

    Yes, this is what I needed!!! So, a quick test showed that you can replace protocol.request with protocol.send and it would still work. The only difference is that you need to create a separate thread that would just wait for the events.

    What you need to do, is something like this:

    [color=green][font=Verdana]Message tserver_event = protocol.receive();
    ProcessEvent(tserver_event);
    [/font][/color]

    That would do the trick!

    Tell me if you need a bit more of a sample!!!
    Vic