QCG-Notification Installation

QCG-Notification requires the  QCG-Core library to be installed (generally it is enough to use the QCG-Core library compilled and installed in a default fashion, but in specific scenarios, additional parameters to the QCG-Core's ./configure script may be needed). If this prerequisite is fulfilled the QCG-Notification may be installed from  sources in a few simple steps:

tar xf qcg-ntf-latest.tar
cd qcg-ntf-2.0.0
./configure --prefix=/opt/qcg --with-qcg-core=/opt/qcg
make
sudo make install

In order to verify later the installation, it is recommended to provide an additional option to ./configure: --with-consumer

Configuration

Before you start you need to create a new system user (e.g. qcg-ntf) that will be used to start the service:

useradd -d  /opt/qcg/var/log/qcg-ntf/ -M  qcg-ntf

Give the qcg-ntf user ownership of the log directory:

chown qcg-ntf /opt/qcg/var/log/qcg-ntf/

Service configuration

Minimal configuration requires only the host and port to be changed in the main service configuration file: PREFIX/etc/qcg-ntfd.xml. The complete configuration guide can be found in the PREFIX/share/qcg-ntf/doc/ directory.

Starting the service

As the qcg-ntf user type:

/opt/qcg/sbin/qcg-ntfd

In this mode the service will run in a background and logs will be generated to /opt/qcg/var/log/qcg-ntf/qcg-ntfd.log.

If you want the service not to daemonize and print all logs to console type:

/opt/qcg/sbin/qcg-ntfd -d

Stopping the service

The service is stopped by sending SIGTERM signal, e.g.:

pkill qcg-ntfd

Verifying the installation

If the service was configured with the option --with-consumer attached to ./configure, the basic verification scenario may be proceeded in a following way:

  1. Set the Host and Port parameters in the configuration files of the QCG-Notification service and sample consumer, respectivetly in /opt/qcg/etc/qcg-ntfd.xml and /opt/qcg/etc/qcg-ntf-consumer.xml. For example, the key part of the qcg-ntfd.xml file may looks as foolows:
    <sm:Module xsi:type="sm:ecm_gsoap.service">
        <sm:Host>127.0.0.1</sm:Host>
        <sm:Port>2211</sm:Port>
        ...
    </sm:Module>
    
    Similarly, the part of qcg-ntf-consumer.xml may have a following form:
    <sm:Module xsi:type="sm:ecm_gsoap.service">
        <sm:Host>127.0.0.1</sm:Host>
        <sm:Port>2212</sm:Port>
        ...
    </sm:Module>
    
  1. Start the qcg-ntfd in a debug mode:
    /opt/qcg/sbin/qcg-ntfd -d
    
  1. Start the qcg-ntf-consumer in a debug mode:
    /opt/qcg/sbin/qcg-ntf-consumer -d
    
  1. Using the sample client program create a subscription in the QCG-Notification service:
    ./qcg-ntf-client -d -u http://127.0.0.1:2211 -S "cons=http://127.0.0.1:2212 top=http://schemas.qoscosgrid.org/comp/2011/04/notification/topic;//*;Full"
    ...
    INF May 17 14:15:51 1128       0xa0262720 [qcg-client-gsoa] Subscribed, subRef: '810917963'
    ...
    
    Note: The created subscription assigns a service running on http://127.0.0.1:2212 to be a consumer of notifications sent on topics from a namespace http://schemas.qoscosgrid.org/comp/2011/04/notification/topic. The subscription id is 810917963
  1. Send a sample notification on a some topic from the namespace http://schemas.qoscosgrid.org/comp/2011/04/notification/topic to the QCG-Notification service:
    ./qcg-ntf-client -d -u http://127.0.0.1:2211 -N "top=http://schemas.qoscosgrid.org/comp/2011/04/notification/topic;ActivityState/Queued;Full msg=<SampleNotification/>"
    ...
    INF May 17 14:19:32 1134       0xa0262720 [qcg-client-gsoa] Notification sent successfully
    ...
    
  1. Check the output of qcg-ntfd and output of qcg-ntf-consumer. The outputs' scripts, in order, should be simillar to the following ones:
    ...
    INF May 17 14:19:32 1113       0xb0185000 [......ecm_gsoap] Serving Notify routine
    INF May 17 14:19:32 1113       0xb0185000 [...............] Sending message to: 'http://localhost:2212'
    INF May 17 14:19:32 1113       0xb0185000 [...............] Notification forwarded to '1' consumers
    INF May 17 14:19:32 1113       0xb0185000 [...............] Forwarded Notification on topic: 'http://schemas.qoscosgrid.org/comp/2011/04/notification/topic/ActivityState/Queued'
    ...
    

    ...
    INF May 17 14:19:32 1120       0xb0491000 [qcg-consumer-gs] Receive notify message:
    INF May 17 14:19:32 1120       0xb0491000 [qcg-consumer-gs] From:  127.0.0.1
    INF May 17 14:19:32 1120       0xb0491000 [qcg-consumer-gs] Topic: <wsnt:Topic xmlns:tns="http://schemas.qoscosgrid.org/comp/2011/04/notification/topic" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Full">tns:ActivityState/Queued</wsnt:Topic>
    ...
    
  1. Finally remove the created subscription:
    ./qcg-ntf-client -d -u http://localhost:2211 -U "id=810917963"
    ...
    INF May 17 14:41:48 3318       0xa0262720 [qcg-client-gsoa] Unsubscribed: '810917963'
    ...