| 1 | [[PageOutline]] |
| 2 | |
| 3 | = QCG-Notification Installation in QosCosGrid= |
| 4 | Within !QosCosGrid the QCG-Notification service is used for brokering notification messages about the job state changes. All instances of the QCG-Computing 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). |
| 5 | |
| 6 | = Installation = |
| 7 | Similarly to the [[http://www.qoscosgrid.org/trac/qcg-computing|QCG-Computing]] service QCG-Notification requires the [[http://www.qoscosgrid.org/trac/qcg-core]] QCG-Core library to be installed]]. If this prerequisite is fulfilled the QCG-Notification installation can be done in a few simple steps: |
| 8 | {{{ |
| 9 | #!div style="font-size: 90%" |
| 10 | {{{#!sh |
| 11 | tar xf qcg-ntf-latest.tar |
| 12 | cd qcg-ntf-2.0.0 |
| 13 | ./configure --prefix=/opt/qcg --with-qcg-core=/opt/qcg |
| 14 | make |
| 15 | sudo make install |
| 16 | }}} |
| 17 | }}} |
| 18 | |
| 19 | In order to verify later the installation, it is recommended to provide an additional option to `./configure`: `--with-consumer` |
| 20 | |
| 21 | = Configuration = |
| 22 | Before you start you need to create a new system user (e.g. `qcg_ntf`) that will be used to start the service: |
| 23 | {{{ |
| 24 | #!div style="font-size: 90%" |
| 25 | {{{#!sh |
| 26 | useradd -d /opt/qcg/var/log/qcg-ntf/ -M qcg_ntf |
| 27 | }}} |
| 28 | }}} |
| 29 | Give the `qcg_ntf` user ownership of the log directory: |
| 30 | {{{ |
| 31 | #!div style="font-size: 90%" |
| 32 | {{{#!sh |
| 33 | chown qcg_ntf /opt/qcg/var/log/qcg-ntf/ |
| 34 | }}} |
| 35 | }}} |
| 36 | == Service configuration == |
| 37 | 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. |
| 38 | |
| 39 | = Starting the service = |
| 40 | As the `qcg_ntf` user type: |
| 41 | {{{ |
| 42 | #!div style="font-size: 90%" |
| 43 | {{{#!sh |
| 44 | /opt/qcg/sbin/qcg-ntfd |
| 45 | }}} |
| 46 | }}} |
| 47 | or if you want the service not to daemonize and print all logs to console type: |
| 48 | {{{ |
| 49 | #!div style="font-size: 90%" |
| 50 | {{{#!sh |
| 51 | /opt/qcg/sbin/qcg-ntfd -d |
| 52 | }}} |
| 53 | }}} |
| 54 | otherwise the logs can be found in `/opt/qcg/var/log/qcg-ntf/qcg-ntfd.log`. |
| 55 | |
| 56 | = Stopping the service = |
| 57 | The service is stopped by sending `SIGTERM` signal, e.g.: |
| 58 | {{{ |
| 59 | #!div style="font-size: 90%" |
| 60 | {{{#!sh |
| 61 | pkill qcg-ntfd |
| 62 | }}} |
| 63 | }}} |
| 64 | |
| 65 | = Verifying the installation = |
| 66 | If the service was configured with the option `--with-consumer` attached to `./configure`, the basic verification scenario may be proceeded in a following way: |
| 67 | |
| 68 | 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: |
| 69 | {{{ |
| 70 | #!div style="font-size: 90%" |
| 71 | {{{#!xml |
| 72 | <sm:Module xsi:type="sm:ecm_gsoap.service"> |
| 73 | <sm:Host>127.0.0.1</sm:Host> |
| 74 | <sm:Port>2211</sm:Port> |
| 75 | ... |
| 76 | </sm:Module> |
| 77 | }}} |
| 78 | }}} |
| 79 | Similarly, the part of `qcg-ntf-consumer.xml` may have a following form: |
| 80 | {{{ |
| 81 | #!div style="font-size: 90%" |
| 82 | {{{#!xml |
| 83 | <sm:Module xsi:type="sm:ecm_gsoap.service"> |
| 84 | <sm:Host>127.0.0.1</sm:Host> |
| 85 | <sm:Port>2212</sm:Port> |
| 86 | ... |
| 87 | </sm:Module> |
| 88 | }}} |
| 89 | }}} |
| 90 | |
| 91 | 2. Start the `qcg-ntfd` in a debug mode: |
| 92 | {{{ |
| 93 | #!div style="font-size: 90%" |
| 94 | {{{#!sh |
| 95 | /opt/qcg/sbin/qcg-ntfd -d |
| 96 | }}} |
| 97 | }}} |
| 98 | |
| 99 | 3. Start the `qcg-ntf-consumer` in a debug mode: |
| 100 | {{{ |
| 101 | #!div style="font-size: 90%" |
| 102 | {{{#!sh |
| 103 | /opt/qcg/sbin/qcg-ntf-consumer -d |
| 104 | }}} |
| 105 | }}} |
| 106 | |
| 107 | 4. Using the sample client program create a subscription in the Smoa Notification service: |
| 108 | {{{ |
| 109 | #!div style="font-size: 90%" |
| 110 | {{{#!sh |
| 111 | ./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 |
| 112 | ... |
| 113 | INF May 17 14:15:51 1128 0xa0262720 [qcg-client-gsoa] Subscribed, subRef: '810917963' |
| 114 | ... |
| 115 | }}} |
| 116 | }}} |
| 117 | '''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` |
| 118 | |
| 119 | 5. 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: |
| 120 | {{{ |
| 121 | #!div style="font-size: 90%" |
| 122 | {{{#!sh |
| 123 | ./qcg-ntf-client -d -u http://127.0.0.1:2211 -N "http://schemas.qoscosgrid.org/comp/2011/04/notification/topic;ActivityState/Queued;Full msg=<SampleNotification/>" |
| 124 | ... |
| 125 | INF May 17 14:19:32 1134 0xa0262720 [qcg-client-gsoa] Notification sent successfully |
| 126 | ... |
| 127 | }}} |
| 128 | }}} |
| 129 | |
| 130 | 6. Check the output of `qcg-ntfd` and output of `qcg-ntf-consumer`. The outputs' scripts, in order, should be simillar to the following ones: |
| 131 | {{{ |
| 132 | #!div style="font-size: 90%" |
| 133 | {{{#!default |
| 134 | ... |
| 135 | INF May 17 14:19:32 1113 0xb0185000 [......ecm_gsoap] Serving Notify routine |
| 136 | INF May 17 14:19:32 1113 0xb0185000 [...............] Sending message to: 'http://localhost:2212' |
| 137 | INF May 17 14:19:32 1113 0xb0185000 [...............] Notification forwarded to '1' consumers |
| 138 | INF May 17 14:19:32 1113 0xb0185000 [...............] Forwarded Notification on topic: 'http://schemas.qoscosgrid.org/comp/2011/04/notification/topic/ActivityState/Queued' |
| 139 | ... |
| 140 | }}} |
| 141 | |
| 142 | {{{#!default |
| 143 | ... |
| 144 | INF May 17 14:19:32 1120 0xb0491000 [qcg-consumer-gs] Receive notify message: |
| 145 | INF May 17 14:19:32 1120 0xb0491000 [qcg-consumer-gs] From: 127.0.0.1 |
| 146 | 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> |
| 147 | ... |
| 148 | }}} |
| 149 | }}} |
| 150 | |
| 151 | 7. Finally remove the created subscription: |
| 152 | {{{ |
| 153 | #!div style="font-size: 90%" |
| 154 | {{{#!default |
| 155 | ./qcg-ntf-client -d -u http://localhost:2211 -U "id=810917963" |
| 156 | ... |
| 157 | INF May 17 14:41:48 3318 0xa0262720 [qcg-client-gsoa] Unsubscribed: '810917963' |
| 158 | ... |
| 159 | }}} |
| 160 | }}} |
| 161 | |
| 162 | = QCG-Computing (QCG BES/AR) integration = |
| 163 | After finishing the QCG-Notification configuration you must edit the QCG-Computing service configuration file again and update the content of the `<ServiceURL>` elements (in `<Module xsi:type="smc:notification_wsa">` section). For e.g. if in the `PREFIX/etc/qcg-ntfd.xml` one can find `<Host>example.com<Host>` and `<Port>19005<Port>` the `<ServiceURL>` in `PREFIX/etc/qcg-compd.xml` must be set to `http://example.com:19005/`. |
| 164 | |
| 165 | '''Note:''' You must restart the QCG-Computing service after updating the `qcg-compd.xml` configuration file. |
| 166 | |
| 167 | When you start the QCG-Notification service and update the QCG-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.: |
| 168 | {{{ |
| 169 | #!div style="font-size: 90%" |
| 170 | {{{#!sh |
| 171 | tail -f /opt/qcg/var/log/qcg-comp/qcg-compd.log |
| 172 | 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) |
| 173 | }}} |
| 174 | }}} |