Using ActiveMQ with Petals ESB

Some of you may have already worked with the Petals JMS component.
This connector works in two different modes. In the first one, said provider, the component exposes services. When invoked, these services post messages on a JMS queue or topic. In the second mode, said consumer, Petals listens to JMS queues or topics and propagates JMS messages as Petals messages intended to Petals services.

The Petals JMS connector is not part of the Petals distribution, for the moment. You have to get the source code from our SVN and compile it yourself.
To put it in the distribution, it would need to support the new Petals logging mechanism. Besides, we have many upgrades to perform on this component. However, it works and can be used in some cases.

Here comes the point where I talk about interactions with ActiveMQ (AMQ).
AMQ is pretty nice and easy to use. I think we can say this is one of the key JMS products in the open-source field. However, there are some limitations to know when using it with Petals. And this is not due to Petals.

Petals and JMS servers can interact through the Petals JMS component. To work, this component needs a JNDI. More exactly, JMS queues and topics must be made available through a JNDI server, so that both Petals and AMQ can read and write in them. Unfortunately, AMQ does not provide a real JNDI implementation. This results in a strong limitation: you cannot work with Petals ESB, AMQ and static queues or topics.

There are 3 workarounds:

  • Do not use AMQ’s JNDI implementation and use an external one.
  • Use dynamic queues or topics. This is a specific mechanism of AMQ. Basically, it consists in choosing dynamicQueues/yourQueue or dynamicTopics/yourTopic as your JMS destination.
  • Add a specific property in the JMS client (Petals JMS connector). Currently, the only solution is to patch the component. I have submitted a feature request to give more flexiblity in what we can pass to the initial context.

This information was also added to the documentation of the Petals JMS component.

Profiling Petals ESB with Eclipse TPTP

Hi,

For those who do not understand the title, this article might help.
Since it took me almost 3 hours to make it work I decided to post some king of tutorial to explain how I proceeded.
This blog
was very helpful, even it was only half of the path.

I here explain the main lines. I don’t detail all the possibilities.

Installing everything

I assume you already installed Petals ESB (Petals 3.0, platform edition).
Go at http://www.eclipse.org/tptp/home/downloads/ to download TPTP All-in-One.

This stand-alone Eclipse application will be the one used to get the profiling information.
Unzip it. Change the memory settings of the application: open Eclipse.ini and upgrade -Xmx to 512.

From the same address, download the Stand Alone Agent Controllers.
Unzip this archive on the disk, and define an environment variable TPTP_AC_HOME which points to the root folder.
If it helps you, in the Petals debug script, TPTP_AC_HOME/plugins is referenced.

Then, run TPTP_AC_HOME/bin/SetConfig.bat (or .sh). It should result in the creation of the file TPTP_AC_HOME/config/serviceconfig.xml.

Eventually, FYI, I slightly changed the PETALS_HOME/bin/debug.bat (.sh) script.
I modified it so that %PROFILE_OPTS% does not contain any quote character (you can just display the command to be sure).
However, I do not know if it was really necessary.

Launching and connecting everything

Since I got troubles with this, I strongly advise you to terminate all the Java processes before running the TPTP profiler.
Run the TPTP_AC_HOME/bin/ACServer script or application.

Then, start Petals with the profiling options PETALS_HOME/bin/debug.bat -P -M memory
These options mean you are profiling (-P) Petals with Eclipse (we could use NetBeans) and that you are watching object allocations.
The available options are specified in the Petals debug script.

Eventually, start the TPTP Eclipse application.

The Petals debug script makes the profiling work in enabled mode. It means it is activated when Eclipse connects to the profiler agent.
To create this connection, follow these steps:

  1. Go into Run > Profile Configurations…
  2. Right-click Attach to Agent and click New.
  3. Give a name to the new configuration, and add it a new port on the localhost (10006).
  4. Select this second port and go into the Agents tab.
  5. Wait few seconds and select the agent that was set by the Petals debug script.
  6. Select Apply and then Profile.

The main profiling tab

The Agent tab in Eclipse TPTP

If an error occurs, you can check the ACServer log.
It is called servicelog.log and located under TPTP_AC_HOME/config.

Profiling…

It’s profiling with 3 dots, as it is not as simple as I expected.
In fact, it is very slow with Petals. I even run into an out-of-memory exception.
This is why I mentionned the memory settings should be upgraded.
I will have to make other tries, as I spent less than 15 minutes to use the profiler.

But the biggest part is already done.