Showing posts with label tibco. Show all posts
Showing posts with label tibco. Show all posts

Tuesday, February 18, 2014

Further Tibco Notes


Sending messages from the command line

In one console, run this:

C:\Users\henphi> tibrvlisten -daemon tcp:HOST:TCP_PORT -service SERVICE_ID "testmsg"

where HOST, TCP_PORT and SERVICE_ID are values suitable for your environment.

In another console, run this:

C:\Users\henphi> tibrvsend -daemon tcp:HOST:TCP_PORT -service SERVICE_ID "testmsg" "message content"
Publishing: subject=testmsg "message content"

and you'll see the first console output:

2014-02-14: 13:46:57 (2014-02-07 13:46.57.889000000Z): subject=testmsg, message={DATA="message content}

Wildcard subjects

If you want to listen to all messages, not just those with a given subject, run:

C:\Users\henphi> tibrvsend -daemon tcp:HOST:TCP_PORT "*.>"

Automatic clustering

Instances of the Tib daemon will automatically cluster if they're on the same subnet unless you start the daemon with something like:

> rvrd -store STORE_FILE -listen TCP_PORT -logfile LOG_FILE -log-max-size 1024 -log-max-rotations 5 -no-multicast

Otherwise, you can have two listeners listening to different HOSTs and they will both receive messages.

Thursday, February 6, 2014

Miscellaneous Tibco notes.

[I am not a Tibco guru. These notes are just me playing around in our UAT environment]

If you listen to a service on a given box, you won't be able to listen to the same service on another daemon on that same box.

For example, if I run:

C:\Users\henphi>tibrvlisten -daemon tcp:HOST:18223 -service 7546 "TESTMSG"
tibrvlisten: Listening to subject TESTMSG
.
.
.

then connecting to the same service on a different daemon on the same box gives:

C:\Users\henphi>tibrvlisten -daemon tcp:HOST:18200 -service 7546 "TESTMSG"
tibrvlisten: Failed to initialize transport: Initialization failed

for reasons outlined below. The same is true for tibrvsend.


Some miscellaneous Tib notes (a.k.a. brain dump) for the interested

Subscription failover demonstration 

If I start another RVRD process, for some reason I don't understand, the store file needs to be different to the one used by the already running Tib daemon (the store file contains the config, I am told).

Anyway, here goes:

mds@HOST[dev]:~> /opt/mds/tibco_8_1/tibrv/8.1/bin/rvrd -store /tmp/rvrd.store -listen 18223 -logfile /tmp/rvrd.log -log-max-size 1024 -log-max-rotations 5
mds@HOST[dev]:~> ps aux | grep rvrd
mds        669  0.3  0.1 104612 57668 ?        Ssl  Jan13   7:10 /opt/mds/tibco_8_1/tibrv/8.1/bin/rvrd -store /opt/mds/tibco_8_1/tibrv/8.1/rvrd.store -listen 18200 -logfile /var/log/mds/rvrd/rvrd.log -log-max-size 1024 -log-max-rotations 5
mds      15235  0.0  0.0  43992 15860 ?        Ssl  15:24   0:00 /opt/mds/tibco_8_1/tibrv/8.1/bin/rvrd -store /tmp/rvrd.store -listen 18223 -logfile /tmp/rvrd.log -log-max-size 1024 -log-max-rotations 5
mds      16952  0.0  0.0   3936   824 pts/3    S+   15:26   0:00 grep rvrd
mds@HOST[dev]:~>

So, our new process has PID 15235. Seeing what ports it has open:

mds@HOST[dev]:~> netstat -nap 2>/dev/null | grep 15235 
tcp        0      0 0.0.0.0:18223           0.0.0.0:*               LISTEN      15235/rvrd 
tcp        0      0 0.0.0.0:62737           0.0.0.0:*               LISTEN      15235/rvrd 
tcp        0      0 0.0.0.0:57401           0.0.0.0:*               LISTEN      15235/rvrd 
udp        0      0 0.0.0.0:54339           0.0.0.0:*                           15235/rvrd 
udp        0      0 0.0.0.0:7543            0.0.0.0:*                           15235/rvrd 
udp        0      0 0.0.0.0:7544            0.0.0.0:*                           15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115673 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115672 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115662 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115661 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115655 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115654 15235/rvrd 
mds@HOST[dev]:~> 

Upon starting a listener on my desktop:

C:\Users\henphi>tibrvlisten -daemon tcp:HOST:18223 -service 7546 "TESTMSG" 

Causes

mds@HOST[dev]:~> netstat -nap 2>/dev/null | grep 15235 
tcp        0      0 0.0.0.0:18223           0.0.0.0:*               LISTEN      15235/rvrd 
tcp        0      0 0.0.0.0:62737           0.0.0.0:*               LISTEN      15235/rvrd 
tcp        0      0 0.0.0.0:57401           0.0.0.0:*               LISTEN      15235/rvrd 
tcp        0      0 128.162.27.135:18223    128.30.71.147:61239     ESTABLISHED 15235/rvrd 
udp        0      0 0.0.0.0:54339           0.0.0.0:*                           15235/rvrd 
udp        0      0 0.0.0.0:7543            0.0.0.0:*                           15235/rvrd 
udp        0      0 0.0.0.0:7544            0.0.0.0:*                           15235/rvrd 
udp        0      0 0.0.0.0:7546            0.0.0.0:*                           15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115673 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115672 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115662 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115661 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115655 15235/rvrd 
unix  3      [ ]         STREAM     CONNECTED     2016115654 15235/rvrd 

Note how the service ID maps to the UDP multicast port Tib uses.

Now, back on my desktop in another window:

C:\Users\henphi>tibrvsend -daemon tcp:HOST2:18200 -service 7546 "TESTMSG" "BLAAAHHHH!!!" 
Publishing: subject=TESTMSG "BLAAAHHHH!!!" 

causes

2014-01-14 16:06:52 (2014-01-14 16:06:52.102000000Z): subject=TESTMSG, message={DATA="BLAAAHHHH!!!"} 

to be output to the other. Since we're sending the message to a different box, this demonstrates that the Tib subscriptions are automatically clustering.

Killing our second Tib process:

mds@HOST[dev]:~> netstat -nap 2>/dev/null | grep 7546 
udp        0      0 0.0.0.0:7546            0.0.0.0:*                           15235/rvrd 
mds@HOST[dev]:~> kill 15235 
mds@HOST[dev]:~> netstat -nap 2>/dev/null | grep 7546 
mds@HOST[dev]:~> 

causes the listening Tib to output

2014-01-14 16:12:17 RV: TIB/Rendezvous Error Not Handled by Process: 
{ADV_CLASS="WARN" ADV_SOURCE="SYSTEM" ADV_NAME="RVD.DISCONNECTED"} 

Subsequent tibrvsends are not received and I can't see any UDP ports being opened on the box it's sending to.

Restarting the listener produces:

C:\Users\henphi>tibrvlisten -daemon tcp:HOST:18223 -service 7546 "TESTMSG" 
tibrvlisten: Failed to initialize transport: Not connected to daemon 

If I restart the daemon listening on port 18223, I can resume tibrvsend and tibrvlisten as normal.