Skip to content

Instantly share code, notes, and snippets.

@dennysfredericci
Created October 16, 2014 20:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennysfredericci/60b8c37191975135ed25 to your computer and use it in GitHub Desktop.
Save dennysfredericci/60b8c37191975135ed25 to your computer and use it in GitHub Desktop.
Tibco Rendezvous Listener Sample
package br.com.fredericci.test;
import java.util.Date;
import com.tibco.tibrv.Tibrv;
import com.tibco.tibrv.TibrvException;
import com.tibco.tibrv.TibrvListener;
import com.tibco.tibrv.TibrvMsg;
import com.tibco.tibrv.TibrvMsgCallback;
import com.tibco.tibrv.TibrvRvdTransport;
public class TibcoListener implements TibrvMsgCallback
{
public static void main(String[] args) throws TibrvException
{
String service = "7500";
String network = "loopback";
String daemon = "tcp:9025";
String subject = "SOME.SUBJECT";
Tibrv.open(Tibrv.IMPL_NATIVE);
TibrvRvdTransport transport = new TibrvRvdTransport(service, network, daemon);
new TibrvListener(Tibrv.defaultQueue(), new TibcoListener(), transport, subject, null);
while (true) {
try {
Tibrv.defaultQueue().dispatch();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public void onMsg(TibrvListener listener, TibrvMsg msg)
{
System.out.println((new Date()).toString() + ": subject=" + msg.getSendSubject() + ", reply=" + msg.getReplySubject() + ", message=" + msg.toString());
System.out.flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment