Tibco Rendezvous (tibrv) C# .Net example
This is an example of broadcast messaging using TIBCO Rendezvous.
You can find more information about queue, dispatcher, transport and other rendezvous concepts in the TIBCO Rendezvous® Concepts pdf documentation.
Command Line:
Receiving messages
tibrvlisten –service <port> -network "<ip-address>" –daemon <port> "<subject>"
tibrvlisten –service <port> -network ";<multicast-ip-address>" –daemon <port> "<subject>"
tibrvlisten -service 7500 -network "192.168.xx.xxx" -daemon 7500 "ME.TEST"
tibrvlisten -service 7500 -network "192.168.xx.xxx" -daemon 7500 "ME.>"
Publishing messages
tibrvsend –service <port> -network "<ip-address>" –daemon <port> "<subject>" "<your-message>"
tibrvsend -service 7500 -network "192.168.xx.xxx" -daemon 7500 "ME.TEST" "Hello World"
Local Daemon Webpage
C# Example:
Add Reference to TIBCO.Rendezvous.dll
Receiver
class Receiver
{public void Run(){TIBCO.Rendezvous.Environment.Open();var subject = "ME.TEST";
var network = "192.168.xx.xxx";
var port = "7500";
Transport transport = new NetTransport(port, network, port);
Listener listener = new Listener(
Queue.Default,transport,subject,new object());listener.MessageReceived += new MessageReceivedEventHandler(listener_MessageReceived);
var dispacher = new Dispatcher(listener.Queue);
dispacher.Join();Console.WriteLine("Client running..");
Console.ReadKey();TIBCO.Rendezvous.Environment.Close();}void listener_MessageReceived(object listener, MessageReceivedEventArgs messageReceivedEventArgs){Console.WriteLine(messageReceivedEventArgs.Message.GetField("Test").Value);
}static void Main(string[] args){new Receiver().Run();
}}
Publisher
class Publisher
{public void Run(){TIBCO.Rendezvous.Environment.Open();var subject = "ME.TEST";
var network = "192.168.xx.xxx";
var port = "7500";
var transport = new NetTransport(port, network, port);
Console.WriteLine("Server running..");
Console.WriteLine("Press x to exit or any other key to send message");
while (true){var m = new Message();
m.SendSubject = subject;m.AddField("Test", "TestValue");transport.Send(m);var line = Console.ReadLine();if (line.ToUpper().Equals("X")) break;}TIBCO.Rendezvous.Environment.Close();}static void Main(string[] args){new Publisher().Run();
}}
Hi,
ReplyDeleteI'd try to do the test and I got the error:
"Could not load file or assembly 'TIBCO.Rendezvous, Version=1.0.4002.32096, Culture=neutral, PublicKeyToken=1a696d1f90f6158a' or one of its dependencies. An attempt was made to load a program with an incorrect format."
I'm using .Net Framework 4.0 and Tibco Rendezvous 8.3.1.
Do you know what I'm doing wrong ?
Thanks
Try changing platform to x86 in Configuration Manager. Looks like Tibco dll's don't support 64bit architecture - or at least the version I'm using.
ReplyDeleteCan you explain the Dispatcher & Queue ??
ReplyDeleteKCHsu have a look at the TIBCO Rendezvous® Concepts pdf document.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletegreat
ReplyDeleteThis comment has been removed by the author.
ReplyDelete