Solved

Tibco Rendezvous

Posted on 2004-10-06
11
2,158 Views
Last Modified: 2012-06-27
Using Delphi 6.0 and Tibco Rendezvous 7.2

I am trying to build a multi-tier application using Tibco's Rendezvous message bus for passing messages and data.  I have gotten the Tibco daemon to run and am successfully listening for messages.  The problem is that when the message comes to me, it is in the form of an OleVariant.  I am very new at COM and I am not sure how to unpack an OleVariant to get at the actual message data.  Has anyone used Tibco and can give me some quick pointers.  I am just looking for a very simple example on how to send and receive messages.  I will post the type library to the end of this message.  It is very long so I hope it comes through OK.  If I can provide any other information that would be helpful, please let me know.  To make things easier just to figure this stuff out, I imported the Tibco type library into Delphi and had it do a component wrapper for me.  I probably wouldn't go this route, but I need a quick way to get started so I can figure this stuff out.  Here is the code from a very simple project that I did just to get things working.  The TibrvListener1onMsg procedure is where the Tibco message comes in

Type library code can be imported from the free Tibco Rendezvous download at http://www.tibco.com/software/enterprise_backbone/rendezvous.jsp
0
Comment
Question by:meyousikmann
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
11 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12245343
...seems like you could use the "ITibrvMsg" interface type to interpret the message (or the TibrvMsg type which is the same thing)
so you declare a variable of that type, and then type cast the OleVariant to that type and assign it to your variable

I don't have that component so I can't give you any example code =o(... but  you could give that a try
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12245344
I just noticed you have a TTibrvMsg component, have you tried droping one of those in your form?
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12247459
Wow... Big post. Wasn't it just easier to dump that type library code on some website somewhere and just post a link to it? There should be more than enough free webservers available. Now this post is so huge that many people might just ignore it.

procedure TForm1.TibrvListener1onMsg(Sender: TObject; var listener, message: OleVariant);
var
  AListener: ITibrvListener; // Assuming this is the right interface...
  AMessage: ITibrvMsg; // Assuming this is the right interface...
begin
  if Succeeded(IDispatch(listener).QueryInterface(ITibrvListener, AListener) then begin
    ShowMessage('got listener!');
  end;
  if Succeeded(IDispatch(Message).QueryInterface(ITibrvMsg, AMessage) then begin
    ShowMessage('got message! ' + AMessage.toString);
  end;
end;

I just had to guess the possible interfaces that you're expecting here but they seem to be the right ones. (I'm not familiar with Tibco Rendezvous.) The IDispatch(Listener) part just allows access to the IDispatch methods that an oleVariant supports. QueryInterface will check if the object supports another interface and if it does, it will return the object as that other interface in the second parameter. Thus, if the method succeeded() you can access AListener and it's methods to check it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:meyousikmann
ID: 12249107
Thanks for the help.  On the point about a long post, I am going to see if it is possible to close this question and re-open with a link to the data as Workshop Alex has suggested.

On BlackTigerX's point, I did try to declare a variable of type ITibrvMsg and then typecast the message to it, but I get invalid typecast error.  The TTibrvMsg in the type library is not an actual component that can be dropped on the form.  I can, however, instantiate an object of that class within my code, but I am unclear as to how that gets me from the OleVariant message object in the event to the actual TTibrvMsg object where I can access its properties and methods.

On Workshop Alex's point, neither of the Succeeded lines of code succeed.  I realize this is difficult as you are unfamiliar with the Tibco Rendezvous stuff.  I think you are on the right track though, without being familiar, in that I need the ITibrMsg object in order to get to the OleVariant data within the message object.  I just don't know how to do that.  If it helps, Tibco does provide a free demo of its Rendezvous message bus that can be downloaded and experimented with if that helps at all.  The link to their free download is http://www.tibco.com/software/enterprise_backbone/rendezvous.jsp.  I thank anyone who can help me out on this.
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 100 total points
ID: 12250639
The QueryInterface method should translate the oleVariant to the interface type that you need. But it could be that I've chosen the wrong interface types for these values. There are too many types to choose from anyway. ;-)

But I found this in the type library:

  _ITibrvListenerEvents = dispinterface
    ['{72E9784A-355C-11D3-86AC-00105A07602D}']
    procedure onMsg(const listener: ITibrvListener; const message: ITibrvMsg); dispid 1;
  end;

This is the event interface that probably handles the event you've mentioned.

Maybe try this:

procedure TForm1.TibrvListener1onMsg(Sender: TObject; var listener, message: OleVariant);
var
  AListener: ITibrvListener; // Assuming this is the right interface...
  AMessage: ITibrvMsg; // Assuming this is the right interface...
begin
  if Succeeded(IDispatch(listener).QueryInterface(IID_ITibrvListener, AListener) then begin // Added IID_ in front of type name.
    ShowMessage('got listener! ' + AListener.getSubject);
  end;
  if Succeeded(IDispatch(Message).QueryInterface(IID_ITibrvMsg, AMessage) then begin // Added IID_ in front of type name.
    ShowMessage('got message! ' + AMessage.toString);
  end;
end;

You just need to convert the oleVariant to the proper object (interface) type.
0
 

Author Comment

by:meyousikmann
ID: 12252618
Thanks again Workshop Alex for giving this a shot but it still doesn't work.  I am going to leave the question open for a while to see if anyone has any other suggestions, but at this point, I am stuck.  I was hoping to learn the COM stuff on the fly and I really don't have the time to read a huge thick book on the subject, but it looks as though I am going to have to spend the time to understand how this works.

By the way, I actually think now that the problem lies in the event itself.  When the listener is created using the component wrapper, it gives me the message event that we have been working with (ie. the one that provides a listener and message object as OleVariants).  I believe the proper way to approach this is to create a listener and somehow get the message event to run through the ITibrvListenerEvents interface.  Using that interface, the listener and message objects are then provided as known objects (ie. ITibrvListener and ITibrvMsg) that I know how to deal with, instead of OleVariants.  I just don't know how to connect all the dots.  I will keep plugging away and see if I can figure this stuff out.
0
 

Author Comment

by:meyousikmann
ID: 12255438
If anyone is interested in downloading the Tibco stuff and trying this out, there is a command line utility that comes with the download that will send a message.  That way, you can test a listener without coding a sender as well.  After installation of the Tibco stuff, the command line utility would be at:

c:\<tibco installation path>\tibrv\bin\tibrvsend.exe and the syntax would look like this    tibrvsend.exe a.b.c "test message"   where a.b.c is the subject of the message and "test message" is the actual data (in this case, a string).

Any takers on this?  I am getting desperate.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12261893
To be honest, I prefer to write the client/server stuff myself. Either by using plain TCP/IP or just as a webservice. I admit, it is a bit complicated but it gives me a lot more control. Plus the advantage of being independant of any third-party tools.
For fun, I'm even trying to send data between by client and server through the raw sockets so I can even kick away the Indy components. This should result in very small executables and DLL's. It's a good way to become familiar with these kinds of techniques. But when I need development speed, I do choose for existing components, though.
0
 

Author Comment

by:meyousikmann
ID: 12347984
I agree with you and I actually had the messaging system built and functional using generic TCP sockets......but the corporate standard is Tibco so I have to use it.

Anyway, I found the answer to my question.  It involves event sinks (ie. TConnectionPoints) with the com object.  I found this site http://www.techvanguards.com/com/ that has all the information needed and even has a downloadable utility to simplify the whole process of hooking up the sinks.  Thanks to Binh Ly, I was able to get this working.

I am going to request that this question be closed and I am going to see if I can award 100 pts to Workshop Alex.  You may not have solved my problem, but you pointed me in the right direction to get the problem solved.

Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question