[[PageOutline]] = QCG Notification Installation = Within !QosCosGrid the QCG Notification service is used for brokering notification messages about the job state changes. All instances of the QCG BES/AR services acts as the information ''Producers'' while the QCG Broker as the ''Consumer''. In most cases it is enough that only one instance of the QCG Notification is deployed per Administrative Domain (i.e.: not necessary one per Cluster). '''Note:''' The implementation name of the QCG Notification service is '''Smoa Notification''' and this name is used as a common in this guide. = Installation = Similar to the Smoa Computing (QCG BES/AR) service the [[http://fury.man.poznan.pl/smoa-downloads/smoa-ntf/smoa-ntf-latest.tar.gz|Smoa Notification]] requires the [[installation_QCG_BES_AR#SMOACorelibrary|Smoa Core library to be installed]]. If this prerequisite is fulfilled the Smoa Notification installation can be done in a few simple steps: {{{ #!div style="font-size: 90%" {{{#!sh $ tar xf smoa-ntf-latest.tar $ cd smoa-ntf-1.1.2 $ ./configure --prefix=/opt/QCG/smoa/ --with-smoa-core=/opt/QCG/smoa/ $ 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. `smoa_ntf`) that will be used to start the service: {{{ #!div style="font-size: 90%" {{{#!sh # useradd -d /opt/QCG/smoa/var/log/smoa-ntf/ -M smoa_ntf }}} }}} Give the `smoa_ntf` user ownership of the log directory: {{{ #!div style="font-size: 90%" {{{#!sh # chown smoa_ntf /opt/QCG/smoa/var/log/smoa-ntf/ }}} }}} == Service configuration == Minimal configuration requires only the host and port to be changed in the main service configuration file: `PREFIX/etc/smoa-ntfd.xml`. The complete configuration guide can be found in the `PREFIX/share/smoa-ntf/doc/` directory. = Starting the service = As the `smoa_ntf` user type: {{{ #!div style="font-size: 90%" {{{#!sh $ /opt/QCG/smoa/sbin/smoa-ntfd }}} }}} or if you want the service not to daemonize and print all logs to console type: {{{ #!div style="font-size: 90%" {{{#!sh $ /opt/QCG/smoa/sbin/smoa-ntfd -d }}} }}} otherwise the logs can be found in `/opt/QCG/smoa/var/log/smoa-ntf/smoa-ntfd.log`. = Stopping the service = The service is stopped by sending `SIGTERM` signal, e.g.: {{{ #!div style="font-size: 90%" {{{#!sh $ pkill smoa-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 Smoa Notification service and sample consumer, respectivetly in `/opt/QCG/etc/smoa-ntfd.xml` and `/opt/QCG/etc/smoa-ntf-consumer.xml`. For example, the key part of the `smoa-ntfd.xml` file may looks as foolows: {{{ #!div style="font-size: 90%" {{{#!xml 127.0.0.1 2211 ... }}} }}} Similarly, the part of `smoa-ntf-consumer.xml` may have a following form: {{{ #!div style="font-size: 90%" {{{#!xml 127.0.0.1 2212 ... }}} }}} 2. Start the `smoa-ntfd` in a debug mode: {{{ #!div style="font-size: 90%" {{{#!sh $ /opt/QCG/smoa/sbin/smoa-ntfd -d }}} }}} 3. Start the `smoa-ntf-consumer` in a debug mode: {{{ #!div style="font-size: 90%" {{{#!sh $ /opt/QCG/smoa/sbin/smoa-ntf-consumer -d }}} }}} 4. Using the sample client program create a following subscription in the Smoa Notification service: {{{ #!div style="font-size: 90%" {{{#!sh $ ./smoa-ntf-client -d -u http://127.0.0.1:2211 -S "cons=http://127.0.0.1:2212 top=http://schemas.smoa-project.com/comp/2009/01/notification/topic;//*;Full ... INF May 17 14:15:51 1128 0xa0262720 [ntf-client-gsoa] Subscribed, subRef: '810917963' ... }}} }}} '''Note:''' The created subscription has a number `810917963` and 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.smoa-project.com/comp/2009/01/notification/topic`. 5. Send a sample notification on a sample topic from the namespace `http://schemas.smoa-project.com/comp/2009/01/notification/topic` to the Smoa Notification service: {{{ #!div style="font-size: 90%" {{{#!sh $ ./smoa-ntf-client -d -u http://127.0.0.1:2211 -N "top=http://schemas.smoa-project.com/comp/2009/01/notification/topic;ActivityState/Queued;Full msg=" ... INF May 17 14:19:32 1134 0xa0262720 [ntf-client-gsoa] Notification sent successfully ... }}} }}} 6. Check the output of `smoa-ntfd` and output of `smoa-ntf-consumer`. The outputs, in order, should be simillar to the following ones: {{{ #!div style="font-size: 90%" {{{#!default ... 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:2233' 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.smoa-project.com/comp/2009/01/notification/topic/ActivityState/Queued' ... }}} }}} {{{ #!div style="font-size: 90%" {{{#!default INF May 17 14:19:32 1120 0xb0491000 [ntf-consumer-gs] Receive notify message: INF May 17 14:19:32 1120 0xb0491000 [ntf-consumer-gs] From: 127.0.0.1 INF May 17 14:19:32 1120 0xb0491000 [ntf-consumer-gs] Topic: tns:ActivityState/Queued ... }}} }}} = Smoa Computing (QCG BES/AR) configuration = After finishing the Smoa Notification configuration you must edit the [[installation_QCG_BES_AR#Serviceconfiguration|Smoa Computing service configuration file]] again and update the content of the `` elements (in `` section). For e.g if in the `PREFIX/etc/smoa-ntfd.xml` one can find `example.com` and `19005` the `` must be set to `http://example.com:19005/`. '''Note:''' You must restart the Smoa Computing service after updating the `smoa-compd.xml` configuration file. When you start the Smoa Notification service and update the SMOA Computing configuration try to submit a simple job and check the Smoa Computing log file to see if there are now any error messages on sending notifications, e.g.: {{{ #!div style="font-size: 90%" {{{#!sh $ tail -f /opt/QCG/smoa/var/log/smoa-comp/smoa-comp.log INF Sep 17 16:15:01 24201 0x44b22940 [notification_ws] Sending notify message (topic = ActivityState/TerminalState/Finished, activity_id = 0544b24a-e960-400e-4910-f1a893632610, status = Finished) }}} }}}