Solved

Tibco Rendezvous

Posted on 2004-10-06
11
2,108 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
  • 4
  • 3
  • 2
11 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
Comment Utility
...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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:meyousikmann
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now