Skip to main content

Problem:

  • Product Name: BES VisiBroker
  • Product Version: 5.x, 6.x
  • Product Component: VisiNotify
  • Platform/OS Version: All

How to configure out a way to get the status of the notification service (ready/not ready) from a shell script?

Resolution:

To figure out a way to get the status of the notification service (ready/not ready) from a shell script you can use the following program.

class NotiChk
{
public static void main (String args[])
    {

    org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, null);
    com.inprise.vbroker.ObjLocation.Agent the_agent = null;
    try {
        the_agent = com.inprise.vbroker.ObjLocation.AgentHelper.narrow(orb.resolve_initial_references("LocationService"));
        } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
            System.err.println ("Not able to resolve references(LocationService): " e);
            System.exit(1);
        } catch (Exception e)  {
            System.err.println ("Not able to locate (LocationService): " e);
            System.exit(1);
        }
        org.omg.CORBA.Object [] notiChannelRefs=null;
        com.inprise.vbroker.ObjLocation.Desc [] notiChannelDescs=null;
        org.omg.CORBA.Object [] notiChannelFactoryRefs=null;
        com.inprise.vbroker.ObjLocation.Desc [] notiChannelFactoryDescs=null;
        String channelName = System.getProperty ("vbroker.notify.channel.name", "default_channel");
        System.err.println ("Service channel name being looked up : " channelName);
        String channelFactoryName = System.getProperty ("vbroker.notify.factory.name", "VisiNotifyChannelFactory");
        System.err.println ("Service channel factory name being looked up : " channelFactoryName);
        try {
            notiChannelRefs = the_agent.all_replica("IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0", channelName);
            notiChannelDescs = the_agent.all_replica_descs("IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0", channelName);
            notiChannelFactoryRefs = the_agent.all_replica("IDL:omg.org/CosEventChannelAdmin/EventChannelFactory:1.0", channelFactoryName);
            notiChannelFactoryDescs = the_agent.all_replica_descs("IDL:omg.org/CosEventChannelAdmin/EventChannelFactory:1.0", channelFactoryName);
        } catch (com.inprise.vbroker.ObjLocation.Fail e) {
            System.err.println ("Agent query failed: " e);
        }
        boolean channelFound = false;
        System.err.println ("Agent returned " notiChannelRefs.length " noti Channel references.");
        for (int i=0; i < notiChannelRefs.length; i ) {
            System.err.println ("channel " i "] - name= " notiChannelDescs.instance_name);
            channelFound = channelName.equals(notiChannelDescs.instance_name);
            if (channelFound)  break;
        }
        boolean channelFactoryFound = false;
        System.err.println ("Agent returned " notiChannelFactoryRefs.length " noti Channel Factory references.");
        for (int i=0; i < notiChannelFactoryRefs.length; i ) {
            System.err.println ("channelFactory " i "] - name= " notiChannelFactoryDescs.instance_name);
            channelFactoryFound = channelFactoryName.equals(notiChannelFactoryDescs.instance_name);
            if (channelFactoryFound) break;
        }
        System.err.println ("channelFound = " channelFound);
        System.err.println ("channelFactoryFound = " channelFactoryFound);
        if (channelFound && channelFactoryFound )
            System.out.println ("Visinotification Service is READY");
        else
            System.out.println ("Visinotification Service is NOT READY");
    return;
    }
}


#VisiBroker
#Security