User avatar
Leslie
Lead Software Architect
Posts: 352
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Creating a Caller

Thu Oct 02, 2014 5:57 pm

Callers in Syn Engine are users or entities that interact with the Engine.  Callers help provide important information to functions , parsers and Data before any type of processing is done.

A SynCaller once created requires an event handler to its ResponseReceived event to catch any response generated by the Engine after a phrase was mapped to a function.

Sample code to create a Caller.

CSharp Code

SynCaller newCaller = new SynCaller(Engine);
newCaller.User.Name = "Sam";
newCaller.ResponseReceived+=newCaller_ResponseReceived;
Everytime a new object of SynCaller class is created its automatically added to the Engine. There is no need to manually add a SynCaller object to the Callers property of the Engine. That will result in the creation of 2 Callers with the same name and dual event calls.

In the above code we have added an event handler to the ResponseReceived event.

A typical handler looks as follow

CSharp Code

private void newCaller_ResponseReceived(object sender, ResponseReceivedEventArgs e)
{
//string response = e.Response.Message;
//Do Something with the Response
}
SynEngine by default has 2 Callers.
  • Main Caller - The default Caller with the highest Priority
  • Service Caller - Caller that receives response generated by Services that were added to the Engine

Return to “Archived (Old Posts)”

Who is online

Users browsing this forum: No registered users and 1 guest