Hi,
I am trying to recieve statistic notification using below code:
//Initialize the protocol
protocolManagementService = new ProtocolManagementService();
statServerConfiguration = new StatServerConfiguration(STATSERVER_IDENTIFIER);
try
{
statServerUri = new Uri("tcp://"
+ statServerHost
+ ":"
+ statServerport);
statServerConfiguration.Uri = statServerUri;
//statServerConfiguration.ClientName =
// Register this connection configuration with Protocol Manager
protocolManagementService.Register(statServerConfiguration);
// Create and Initialize Message Broker Application Block
if (OpenProtocol())
{
eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);
try
{
eventBrokerService.Register(
StatServerEventsHandler);
}
catch (ProtocolException ex)
{ }
// Activate event broker service
eventBrokerService.Activate();
}
else
objLog.Log("Protocol Not opened");
}
catch (Exception ex)
{
objLog.Log(ex.Message);
}
//Open Statistic
RequestOpenStatistic request = RequestOpenStatistic.Create();
// Statistic Object
//String selectedObjectTypeName = "Agent";
//StatisticObjectType selectedObjectType = StatisticObjectType.Agent; // Dummy default value
String selectedObjectTypeName = "DN";
StatisticObjectType selectedObjectType = StatisticObjectType.RegularDN; // Dummy default value
if (selectedObjectTypeName == "Agent")
{
selectedObjectType = StatisticObjectType.Agent;
}
else if (selectedObjectTypeName == "Place")
{
selectedObjectType = StatisticObjectType.AgentPlace;
}
else if (selectedObjectTypeName == "Queue")
{
selectedObjectType = StatisticObjectType.Queue;
}
else if (selectedObjectTypeName == "DN")
{
selectedObjectType = StatisticObjectType.RegularDN;
}
StatisticObject statisticObject =
StatisticObject.Create(
"3103111",
selectedObjectType,
TENANT_NAME);
// Metric
StatisticMetric statisticMetric = StatisticMetric.Create("TotalTime");
//StatisticMetric statisticMetric = StatisticMetric.Create("TotalAdjustedNumber");
// Notification
Notification notification = Notification.Create();
notification.Mode = NotificationMode.Periodical; // To get Notifications after every defined interval
notification.Frequency = NOTIFICATION_FREQUENCY;
request.StatisticObject = statisticObject;
request.StatisticMetric = statisticMetric;
request.Notification = notification;
// Need to set this reference id value. This reference id becomes statistic id for all
// future requests on this statistic and needs to be specified when performing
// any action on this statistic like closing, suspending or resuming etc.
request.ReferenceId = STATISTIC_REFERENCE_ID;
objLog.Log(request.ToString());
protocolManagementService[STATSERVER_IDENTIFIER].Send(request);
I am recieving protocol exception as "connection is not opened" in below code:
protocolManagementService[STATSERVER_IDENTIFIER].Send(request);