ActiveX
Question 1: How does FioranoMQ provide for ActiveX controls?
FioranoMQ's ActiveX controls allow Win32 applications to leverage the power of JMS. FioranoMQ provides JMS ActiveX controls that can be embedded in any application developed in VisualBasic, VJ++ or VC++. These downloadable ActiveX controls enable the Win32 Applications to use both PTP and Publisher-Subscriber JMS architectures. These ActiveX controls provide for seamless exchange of JMS messages among Win32 Applications and between Win32 and Java Applications. FioranoMQ supports publishing and synchronous and asynchronous receipt of messages on topics and queues. FioranoMQ uses the bridge provided by Microsoft to register JavaBeans as ActiveX controls. The bridge used is bundled along with Microsoft SDK for Java 4.0. This bridge enables the Java Class or Bean to be registered as an ActiveX control or component to be used as any other ActiveX control from within Win32 applications.
Question 2: How do I use ActiveX controls in my Win32 Applications?
Download the ActiveX controls for Pub/Sub and PTP. These samples illustrate the use of JMS ActiveX controls within a Visual Basic application. Register the Java classes as ActiveX controls. You need to use javareg to register Java classes as ActiveX Controls. After the classes are registered as ActiveX controls, an application developed in Visual Basic can use the controls as follows:
On successful initialization, the controls return a positive value and if there is an error while initializing, a negative value is returned. Depending on the return parameter, the developer can determine the flow of action as follows:
To publish on various queues and topics other than the default (primaryQueue/pri-maryTopic), you need to change the connectionfactory names and the topic/queue names as follows:
All the above mentioned scripts are with respect to a Visual Basic development environment.
Question 3: How do I set up a sample VB Application with ActiveX controls that communicate with each other?
You first need to register the Activex controls on your system. To import the controls into the Visual Basic controls toolbox, perform the following steps:
- Navigate to Projects in the menubar and select Components. This can also be accessed through a windows shortcut Ctrl+T.
- This opens a dialog box that displays the various ActiveX controls and components registered with the windows system.
- Select the check boxes corresponding to the following: fio-rano.fmq.beans.FMQPublisherBean and fiorano.fmq.beans.FMQSubscriber-Bean.
- Now, these two controls is displayed on the controls tool box. To use them, drag and drop them on the sample application you have created.
If you have not yet created a sample application, follow the steps given below to develop it, shown in Figure 10-1, with the following assumptions:
- The Publisher-subscriber model is to be used.
- The default topic is used. This implies that the messages are published/sub-scribed on the "primaryTopic".
For example, the sample application has the following functionalities:
- Text in the text field is published when Publish is clicked
- Messages are added to the list of received messages when Subscribe is clicked.
A message is to be published first before subscribing to it, else Subscriber times-out after 5 seconds, and return a blank string.
Figure 1: Sample VB Application using ActiveX Controls
The following code shows the basic setup needed to create a sample application:
Question 4: What are the limitations of ActiveX controls?
The controls that are currently provided ,do not allow for asynchronous data receipts. Each control works in the context of its sessions and connections. Future version of these controls provides for resource sharing among the controls. Currently, the ActiveX controls support only TextMessages.
JMS Beans/ActiveX Controls
Question 5: Can JMS be used inside a JavaBeans or C++ COM object?
The JMS design and FioranoMQ Server architecture allows JMS APIs to be used as Java Beans or as COM objects. ActiveX components for FioranoMQ are expected to be released soon.
Question 6: Does Fiorano provide ActiveX Controls to communicate with the Messaging Server?
FioranoMQ does, provide support for ActiveX controls.
Other ActiveX Issues
Question 6: What are the Platform requirements and software that needs to be installed?
Following are the platform requirements:
- Microsoft SDK for Java 4.0
- Microsoft's JRE (jview version 5.0 and higher)
- Any Win32 development environment, such as VB, VC or VJ++.
Question 8: How do I register the JavaBeans as ActiveX controls?
Batch files are provided for both installing and uninstalling the beans as controls. These scripts use the Microsoft SDK for Java 4.0 to install/uninstall the components (found in the output directory of the samples).
In case, you developed the control for use with FioranoMQ, then you need to edit these scripts to include your control name. Care should be taken here to specify a unique class for your class.
Question 9: What are the necessary setup issues to use JavaBeans ActiveX controls?
Prior to using these ActiveX components, make sure that javareg executable is available in the System PATH. javareg (of the MS SDK) is a binary executable usually present in the "bin" directory of MS SDK installation. The CLASSPATH should include all of the following:
FioranoMQ Classes: jsse.jar, httpclient.zip, jetty.zip, sslava.jar, jnet.jar, jcert.jar, dxml.jar, xml4j.jar, jnet.jar, jms.zip, fmq-rtl.jar and fmq-common.jar.
All these files are located in the /fmq/lib directory of FioranoMQ installation.
In case the CLASSPATH settings are incorrect, javareg only register the ActiveX components in the Windows Registry but fails to make the tlb files, which are required for using the ActiveX components from any Win32 application.
Question 10: While trying to run the VB examples that use FioranoMQ ActiveX controls, why does it throw a "ClassNotFound" exception?
This exception is encountered when JNDI classes are not available in the CLASSPATH settings. Please set jndi.jar in your classpath and then try registering the ActiveX components. You could either use this jndi.jar or the rt.jar file that is bundled with JDK installation for the same purpose.
Active JMS
Question 11: How can FioranoMQ be made to work with ActiveJMS ?
Active JMS is a freely available open source project that provides non-proprietary ActiveX JMS client APIs. You can use these APIs to access JMS functionality of FioranoMQ. Follow the steps given below to use Active JMS with FioranoMQ.
- Download Active JMS from the link http://active-jms.sourceforge.net/ and install Active JMS.
- Copy the fmq-rtl.jar, fmq-common.jar and csp.zip in the fmq/lib/ext directory of the JRE that was configured with the activeJMS in its installation.
- Update the active-jms.properties file (present in the "samples" directory of Active JMS installation) and make the following modifications.
- Set the resource provider as FioranoMQ. activejms.providers.default=FioranoMQ
Update the username-password or the URL of the server in the following properties as per your configurations.
6. Register the active-jms.tlb present in the bin directory in your visual basic project reference. (Select Projects > References > Active JMS Bean Control)
7. Finally, run the default visual basic samples that are shipped with the active-JMS installation. You should be able to send and receive JMS messages with FioranoMQ server. The following figure displays the output of one such test.
Figure 2: JMS messages sent and received with FioranoMQ server
For more details on Active JMS, please refer to the document Getting Started.doc shipped with the Active JMS installation.