Author Topic: Platform SDK - Not receiving notification from Config Server  (Read 5041 times)

Offline cpoon

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Platform SDK - Not receiving notification from Config Server
« on: February 10, 2011, 02:32:42 AM »
Hi,

I'm trying to develop an application (using Platform SDK 7.6) to know when there's any update/creation/deletion to any DN of "Extension" type on the Config Server.

I've submitted a "RequestRegisterNotification" to Config Server and receive "EventNotificationRegistered" in return. However, even after I tried to create a new DN and delete DN using CME, my application is not receiving any further updates. Though I do notice the events are captured in the Conf Server logs.

My codes are as follows:
=========================================
pMgtSvc = new ProtocolManagementService();

ConfServerConfiguration confServerConfig = new ConfServerConfiguration("Config_Server");
confServerConfig.Uri = new Uri("tcp://" + configHost + ":" + configPort);
confServerConfig.ClientName = clientName;
confServerConfig.ClientApplicationType = CfgAppType.CFGSCE;
confServerConfig.UserName = userName;
confServerConfig.UserPassword = password;
pMgtSvc.Register(confServerConfig);
pMgtSvc["Config_Server"].Open();

eventBrokerService = BrokerServiceFactory.CreateEventBroker(pMgtSvc.Rec eiver);
eventBrokerService.Register(this.OnEventError, new MessageIdFilter(Genesyslab.Platform.Configuration. Protocols.ConfServer.Events.EventError.MessageId)) ;
eventBrokerService.Register(this.OnEventObjectRead , new MessageIdFilter(EventObjectsRead.MessageId));
eventBrokerService.Register(this.OnEventObjectCrea ted, new MessageIdFilter(EventObjectCreated.MessageId));
eventBrokerService.Register(this.OnEventObjectUpda ted, new MessageIdFilter(EventObjectUpdated.MessageId));
eventBrokerService.Register(this.OnEventObjectDele ted, new MessageIdFilter(EventObjectDeleted.MessageId));
eventBrokerService.Register(this.OnEventObjectSent , new MessageIdFilter(EventObjectsSent.MessageId));
eventBrokerService.Register(this.OnEventSubscribed , new MessageIdFilter(EventNotificationRegistered.Messag eId));

KeyValueCollection subcription = new KeyValueCollection();
subcription.Add("tenant_id", 101);
subcription.Add("object_type", (int)CfgObjectType.CFGDN);
subcription.Add("dn_type", (int)CfgDNType.CFGExtension);

RequestRegisterNotification requestNotification = RequestRegisterNotification.Create();
requestNotification.Subscription = new KeyValueCollection();
requestNotification.Subscription.Add(subcription);
pMgtSvc["Config_Server"].Send(requestNotification);

==========================================

I've restarted both Config Servers to no avail. Any ideas what I'm missing?

Thanks in advance,
cp

Offline spin

  • Newbie
  • *
  • Posts: 7
  • Karma: 2
Re: Platform SDK - Not receiving notification from Config Server
« Reply #1 on: June 07, 2016, 08:43:43 PM »
I had this problem too, and this was the only post I could find on the subject so now I've resolved it I thought for the benefit of others in the future he's the solution.

When adding the subscription to requestNotification you need to use the Method Add(String, KeyValueCollectionBase(Of T))

So the code should be

KeyValueCollection subcription = new KeyValueCollection();
subcription.Add("tenant_id", 101);
subcription.Add("object_type", (int)CfgObjectType.CFGDN);
subcription.Add("dn_type", (int)CfgDNType.CFGExtension);

RequestRegisterNotification requestNotification = RequestRegisterNotification.Create();
requestNotification.Subscription = new KeyValueCollection();
requestNotification.Subscription.Add("something_unique", subcription); // this is the only line I've changed
pMgtSvc["Config_Server"].Send(requestNotification);