Softwareentwicklung (RRZE)

Informationen rund um die Softwareentwicklung am RRZE

Inhalt

Apache Camel deprecates hazelcast:seda

The long migration of the Camel

Apache Camel LogoAt the time of writing of this post the website of the Apache Camel ™  framework has been undergoing a major migration to GitHub for quite a while. If you are looking for information the best place to start at this moment is with the README.md file on GitHub. Detailed documentation of the existing components can currently be found on the components page also on GitHub. We keep our fingers crossed for the Apache Camel team – we hope you will complete soon the migration. We are big fans of your work.

Deprecation of hazelcast:seda

Hazelcast LogoThe hazelcast:seda component has been deprecated. I am not exactly sure in which Apache Camel version this happened but the one we are currently using (2.21.x) in our Grails Kamel plugin displays a warning message. The good news is – the component is still here, it has been renamed to: hazelcast-seda. So if you want to migrate to the new component all you need to do is replace the hazelcast:seda with hazelcast-seda.

Not so fast

carWait, not so fast – there is a small caveat! If you have a look in the component’s documentation you will find some parameters you can use. What is of major importance for us is the hazelcastInstanceName. If you do not set this component parameter the route will still start up and can process data, however it will use a default hazelcast instance initiated by the Apache Camel context. The instance will be named something like hazelcastInstance_dev1. The Apache Camel context tries to load a hazelcast instance named ‚hazelcastInstance‘ and if this instance does not exists, it gets created using the configuration in hazelcast-default.xml. Generally speaking this instance will perform just fine but will be confined only to the current machine (Docker exposed ports and so). This  however is not what we are after.

Migration

So how do we migrate? Let’s assume there is a hazelcast instance named hazelcast in your application. If you are using the encore plugin with the default settings this will be exactly the case. There are two possible ways to configure properly the route in our case (from the Apache Camel documentation):

  • hazelcastInstanceThe hazelcast instance reference which can be used for hazelcast endpoint.
  • hazelcastInstanceName The hazelcast instance reference name which can be used for hazelcast endpoint. If you don’t specify the instance reference, camel use the default hazelcast instance from the camel-hazelcast instance.

Here is a short example of how the configuration can be changed. I will use the hazelcastInstanceName parameter because it is easier to use. Assuming you have a route named myRoute, your configuration should change from:

hazelcast:seda:myRoute?transferExchange=true&pollTimeout=1000&concurrentConsumers=7

to:

hazelcast-seda:myRoute?hazelcastInstanceName=hazelcast&transferExchange=true&pollTimeout=1000&concurrentConsumers=7

Please note the hazelcastInstanceName=hazelcast part. If you have registered the hazelcast instance under a different name you have to adjust the example above accordingly.

That’s all. Happy Camel riding and routing. I hope you find this short post helpful. By the way – this is the first post on our new blog.