Skip to main content
Skip table of contents

FioranoMQ and ActiveX Controls


Question 1: How does FioranoMQ provide for ActiveX controls?

Answer: 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?

Answer: 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:

CODE
Private Sub Form_Load()-+++++ Dim x As Integer Dim y As Integer x = Me.FMQPublisher1.Initialize y = Me.FMQSubscriber1.Initialize If x = -1 Or y = -1 Then MsgBox "MQServer not up yet.Start the server and restart the app", vbCritical, Error Unload Me End If< End Sub The VB application can start publishing and subscribing like a normal Java application. Private Sub Command1_Click() FMQPublisher1.publish "Sending >>" & Text1.Text End Sub Private Sub Command2_Click() 
Text2.Text = "Received this >>" & FMQSubscriber1.receiveMessage End Sub The QueueReceiver and QueueSender controls can be used in a similar fashion. To bind onto the local MQ server you can run the sample without any further set up. In order to use a non local MQ server, say on a host called "asterix" you need to 
set the host and the port as follows: FMQPublisher1.setHost "asterix" FMQPublisher1.setPort 2001 

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:

CODE
FMQPublisher1.setTopicConnectionFactoryName "primaryTCF" FMQPublisher1.setTopicName "primaryTopic" 

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?

Answer: 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:

  1. Navigate to Projects in the menubar and select Components. This can also be accessed through a windows shortcut Ctrl+T.
  2. This opens a dialog box that displays the various ActiveX controls and components registered with the windows system.
  3. Select the check boxes corresponding to the following: fio-rano.fmq.beans.FMQPublisherBean and fiorano.fmq.beans.FMQSubscriber-Bean.
  4. 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:

  1. The Publisher-subscriber model is to be used.
  2. 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 10-1 Sample VB Application using ActiveX Controls

The following code shows the basic setup needed to create a sample application:

CODE
Private Sub Form_Load() Dim x As Integer Dim y As Integer< x = Me.FMQPublisher1.Initialize y = Me.FMQSubscriber1.Initialize If x = -1 Or y = -1 Then MsgBox "MQServer not up yet.Start the server and restart the app", vbCritical, Error Unload Me End If End Sub Private Sub publishBtn_Click() FMQPublisher1.publish "Sending >>" & message.Text End Sub Private Sub subscribeBtn_Click() Dim str As String< str = "Received this >>" & FMQSubscriber1.receiveMessage mesgList.AddItem str End Sub 


Question 4: What are the limitations of ActiveX controls?

Answer: 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?

Answer: 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?

Answer: FioranoMQ does, provide support for ActiveX controls.

Other ActiveX Issues

Question 7: What are the Platform requirements and software that needs to be installed?

Answer: 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?

Answer: 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?

Answer: 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?

Answer: 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 ?

Answer: 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.

  1. Download Active JMS from the link http://active-jms.sourceforge.net/ and install Active JMS.
  2. 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.
  3. Update the active-jms.properties file (present in the "samples" directory of Active JMS installation) and make the following modifications.
  4. Set the resource provider as FioranoMQ. activejms.providers.default=FioranoMQ
  5. Update the username-password or the URL of the server in the following properties as per your configurations.
CODE
activejms.providers.FioranoMQ.username=anonymous 
activejms.providers.FioranoMQ.password=anonymous 
activejms.providers.FioranoMQ.properties.java.naming.provider.url=http://localhost:1856

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 10.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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.