How to Convert mlt xml file to a melt script - mlt

I have an mlt xml file and I want to convert it to a melt script.
<?xml version="1.0" ?>
<mlt>
<profile description="DV/DVD NTSC" display_aspect_den="3" display_aspect_num="4" frame_rate_den="1001" frame_rate_num="30000" height="480" progressive="0" sample_aspect_den="9" sample_aspect_num="8" width="720"/>
<tractor id="tractor0">
<multitrack>
<playlist id="Background Track">
<producer id="90845eaa-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="1164" novdpau="1" out="1163">
<property name="mlt_service">color</property>
</producer>
</playlist>
<playlist id="Track 1">
<producer id="481e211e-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="1154" novdpau="1" out="1153">
<property name="resource">/home/mahi/Desktop/Short Video Resume.mp4</property>
</producer>
</playlist>
<playlist id="Track 2">
<blank length="10.0"/>
<producer id="4e16767a-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="130" novdpau="1" out="129">
<property name="resource">/home/mahi/Desktop/output/mov/intro.mov</property>
</producer>
<blank length="14.0"/>
<producer id="523cf170-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="110" novdpau="1" out="109">
<property name="resource">/home/mahi/Desktop/output/mov/name_title.mov</property>
</producer>
<blank length="74.0"/>
<producer id="4bbfdf06-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="238" novdpau="1" out="237">
<property name="resource">/home/mahi/Desktop/output/mov/4 items.mov</property>
</producer>
<blank length="43.0"/>
<producer id="56440a06-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="118" novdpau="1" out="117">
<property name="resource">/home/mahi/Desktop/output/mov/head_title.mov</property>
</producer>
<blank length="50.0"/>
<producer id="57ed29aa-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="179" novdpau="1" out="178">
<property name="resource">/home/mahi/Desktop/output/mov/3 items.mov</property>
</producer>
<blank length="65.0"/>
<producer id="50bf816e-7e94-11e6-8271-d8cb8ae1b41a" in="0" length="130" novdpau="1" out="129">
<property name="resource">/home/mahi/Desktop/output/mov/outro.mov</property>
</producer>
</playlist>
</multitrack>
<filter gain="1" in="0" mlt_service="volume" out="1153" track="1"/>
<transition in="0" out="1153">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">1</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="0" out="1153">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">1</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="10" mlt_service="volume" out="139" track="2"/>
<transition in="10" out="139">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="10" out="139">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="154" mlt_service="volume" out="263" track="2"/>
<transition in="154" out="263">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="154" out="263">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="338" mlt_service="volume" out="575" track="2"/>
<transition in="338" out="575">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="338" out="575">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="619" mlt_service="volume" out="736" track="2"/>
<transition in="619" out="736">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="619" out="736">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="787" mlt_service="volume" out="965" track="2"/>
<transition in="787" out="965">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="787" out="965">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
<filter gain="1" in="1031" mlt_service="volume" out="1160" track="2"/>
<transition in="1031" out="1160">
<property name="mlt_service">composite</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="progressive">1</property>
<property name="geometry">0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; </property>
<property name="halign">centre</property>
<property name="valign">centre</property>
<property name="distort">0</property>
<property name="fill">1</property>
</transition>
<transition in="1031" out="1160">
<property name="mlt_service">mix</property>
<property name="a_track">0</property>
<property name="b_track">2</property>
<property name="combine">1</property>
<property name="always_active">1</property>
</transition>
</tractor>
</mlt>
The melt script I have written is not giving the same output as the above XML file.
melt -track Short\ Video\ Resume.mp4 -track intro.mov in=0 out=129 name_title.mov in=0 out=109 outro.mov in=0 out=129

Related

How to stop consuming messages in a camel route when destination unavailable

I'm bridging IBM and ActiveMQ queues with Camel.
Everything works ok, but when destination becomes unvailable because of network problem all the processed messages get lost.
Camel should stop consuming from origin if destination is unavailable and start again when it becomes available, but I don't find correct pattern/configuration to do that.
I'm configuring routes like following one from IBM MQ to IBM MQ, but I'm looking for a way to solve any combination of IBM and ActiveMQ.
<bean id="lsywmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="${mq_lsy_hostname}" />
<property name="port" value="${mq_lsy_port}" />
<property name="queueManager" value="${mq_lsy_queuemanager}" />
<property name="channel" value="${mq_lsy_channel}" />
<property name="useConnectionPooling" value="true" />
</bean>
</property>
</bean>
<bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="${mq_hostname}" />
<property name="port" value="${mq_port}" />
<property name="queueManager" value="${mq_queuemanager}" />
<property name="channel" value="${mq_channel}" />
<property name="useConnectionPooling" value="true" />
</bean>
</property>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false" >
<route id="EFF2AVIO">
<from uri="lsywmq:queue:{{mq_lsy_queue}}"/>
<to uri="wmq:queue:{{mq_queue}}"/>
</route>
</camelContext>
I would like to get it working as a pipeline, if it get stuck at destination, all the pipe remains stucked.
You need to set the transacted property of the JMS connectionFactory to true.
This won't actually stop your consumer, but you'll get the Guaranteed Delivery EIP pattern implemented, so your messages wont't be lost any more.
From now on you could also provide redelivery policy for the ActiveMQ connectionFactory, something that will be relevant for you, e.g. a long redeliveryDelay
You may use JMSConfiguration object to configure JMS options like this
<bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="transacted" value="true"/>
<property name="connectionFactory" ref="myConnectionFactory"/>
</bean>
<bean id="myConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="${mq_lsy_hostname}" />
<property name="port" value="${mq_lsy_port}" />
<property name="queueManager" value="${mq_lsy_queuemanager}" />
<property name="channel" value="${mq_lsy_channel}" />
<property name="useConnectionPooling" value="true" />
</bean>

How to make my transaction commit in ActiveMQ, when my process is done successfully at the client side

<route>
<from
uri="jms:queue:inBox?concurrentConsumers=20" />
<camel:process ref="processor1" />
<transacted/>
<camel:process ref="Processor2" />
</route>
once my Processor 2 is successful then the inbox queue has to de-queue the message from activeMQ. Currently it is dequeuing the messages at the JMS Endpoint.
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConnectionFactory"
class="com.mypackage.EncryptionAwareActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="userName" value="admin" />
<property name="password" value="#PASSWORD#" />
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="20" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="concurrentConsumers" value="50" />
<property name="deliveryPersistent" value="true" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="jmsTransactionManager" />
</bean>
<bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
So I'm using this configuration like this and setting transacted as true And also i have used JMS transnational manager.
It's not enough to just add <transacted/> to your route. You also need to configure your JMS component to support transactions.
I suggest you read the documentation thoroughly.
Below is a relevant code example from the link:
<bean id="jmstx" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="transactionManager" ref="jmsTransactionManager"/>
<property name="transacted" value="true"/>
<property name="cacheLevelName" value="CACHE_CONNECTION"/>
</bean>
<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://broker1?brokerConfig=xbean:tutorial/activemq.xml"/>
</bean>

JMS Transaction simple example

I try to implement a simple jms transaction test. I want to check that my message is left in my ActiveMQ broker's queue after an exception occurs in my route.
In this test, the exception occurs after a new message is posted in the queue but the message is not in the queue any longer as I was expecting. What I'am missing ? blueprint code below
<bean id="jmstx" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="transactionManager" ref="jmsTransactionManager" />
<property name="transacted" value="true" />
<property name="cacheLevelName" value="CACHE_CONNECTION" />
</bean>
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="userName" value="smix" />
<property name="password" value="smix" />
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="0" />
</bean>
</property>
</bean>
<bean id="myEx" class="java.lang.Exception" />
<camelContext id="ctx_m27" xmlns="http://camel.apache.org/schema/blueprint">
<route id="rt_m27_01" trace="false" autoStartup="true">
<from uri="jmstx:queue:Q.m27_IN" />
<throwException ref="myEx" />
<to uri="jmstx:queue:Q.m27_OUT" />
</route>
</camelContext>
You have configured the broker to not use redelivery, eg
<property name="maximumRedeliveries" value="0" />
So when the transaction fails, the message is not redelivered, and then the broker moves the message to its dead letter queue (DLQ). So the message is there.
You can read more about the DLQ in ActiveMQ here: http://activemq.apache.org/message-redelivery-and-dlq-handling.html
Thanks to Claus answer, I've changed redeliveryPolicy to :
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="-1" />
<property name="initialRedeliveryDelay" value="2000" />
<property name="redeliveryDelay" value="60000" />
<property name="useExponentialBackOff" value="false"/>
</bean>
</property>
In fact, cacheLevelName parameter need also to be changed to :
<property name="cacheLevelName" value="CACHE_CONSUMER" />
Default value (CACHE_AUTO), CACHE_NONE and CACHE_SESSION causes strangely redelivery delay to 0.

Moving to ZIG ZAG merge versus optimal indexes

My application currently defines all optimal indexes needed. But slowly I start suffering from the exploding indexes problem, so I want to switch my strategy and start using "zig-zag" merge as explained here.
My entity Contact has 3 sort orders :
lastModified ASC
fullNameUpperCase ASC + DESC
It has 4 filters :
contactProfile
contactStatus
contactType
searchFields (inequality query to emulate 'startsWith...')
searchFields is a special case,because I use it to emulate 'startswith' like this
query = query.filter("searchFields >= ", criteria.getSearchString().toUpperCase());
query = query.filter("searchFields <= ", criteria.getSearchString().toUpperCase() + "\ufffd");
Following the explanations in the article, I need to define
(number of filters + 1) * (number of orders) = 5 * 3 = 15.
My main problem! :
The new definitions below seem to work on the development server but not the first time. The first time it should do new combination of zigzag merge, the devserver still throws the DatastoreNeedIndexException. Repeating the same query for a second time, the query runs and returns expected results. This also happens when paging through the results. The first time I query the next page, exception is thrown. Repeating works. Anybody has seen this behaviour too ? Is this devserver problem or am I missing something ? Or is this index-building that is incomplete at first maybe... e.g. the devserver complains this is missing as an index the first time I combine these filters :
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc"/>
<property name="status" direction="asc"/>
<property name="fullNameUpperCase" direction="desc"/>
</datastore-index>
Here are the new index definitions for entity Contact :
<!-- SORT ORDERS -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
</datastore-index>
<!-- FILTER: SEARCHFIELDS -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<!-- FILTER: CONTACTSTATUS -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
<property name="status" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
<property name="status" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
<property name="status" direction="asc" />
</datastore-index>
<!-- FILTER: CONTACTTYPE -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
<property name="contactType" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
<property name="contactType" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
<property name="contactType" direction="asc" />
</datastore-index>
<!-- FILTER: CONTACTPROFILE -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
<property name="contactProfile" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
<property name="contactProfile" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
<property name="contactProfile" direction="asc" />
</datastore-index>
The problem that it does not work was fixed after I moved the sort order to being the last property of the in the combined indexes.
So for instance
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
<property name="status" direction="asc" />
</datastore-index>
had to become.
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
so the last property is the sort order.
Secondly, the seachFields must be considered as sort orders and I have to make the combination. The indexes now become
5 sort orders :
lastModified ASC
fullNameUpperCase ASC + DESC
searchFields ASC + DESC
3 filters :
contactProfile
contactStatus
contactType
(number of filters + 1) * (number of orders) = 4 * 5 = 20 indexes.
Here's the fully functional list :
<!-- SORT ORDERS -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="fullNameUpperCase" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="lastModified" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="searchFields" direction="desc" />
</datastore-index>
<!-- FILTER: CONTACTSTATUS -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="fullNameUpperCase" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="lastModified" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="status" direction="asc" />
<property name="searchFields" direction="desc" />
</datastore-index>
<!-- FILTER: CONTACTTYPE -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactType" direction="asc" />
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactType" direction="asc" />
<property name="fullNameUpperCase" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactType" direction="asc" />
<property name="lastModified" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactType" direction="asc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactType" direction="asc" />
<property name="searchFields" direction="desc" />
</datastore-index>
<!-- FILTER: CONTACTPROFILE -->
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc" />
<property name="fullNameUpperCase" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc" />
<property name="fullNameUpperCase" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc" />
<property name="lastModified" direction="desc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc" />
<property name="searchFields" direction="asc" />
</datastore-index>
<datastore-index kind="Contact" ancestor="true" source="manual">
<property name="contactProfile" direction="asc" />
<property name="searchFields" direction="desc" />
</datastore-index>
PS : I removed the additional questions on how to migrate a production environment to new indexes, I will post a new question in case needed;

Redelivery delay settings doesn't work on ActiveMQXAConnectionFactory

I've been trying to configure a jms endpoint (activemq 5.7) in my camel context (camel 2.8) so it should use redelivery of messages on rollback. Unfortunately, it doesn't work as I've expected: it returns back a message to a queue, but a consumer takes the message in despite of specified delay parameters immediately after that.
My configuration is the following:
...
<bean id="jmstx" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsTxConfig" />
</bean>
<bean id="jmsTxConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsXaPoolConnectionFactory"/>
<property name="transactionManager" ref="osgiPlatformTransactionManager"/>
<property name="transacted" value="false"/>
<property name="cacheLevelName" value="CACHE_NONE"/>
<property name="concurrentConsumers" value="${jms.concurrentConsumers}" />
</bean>
<bean id="jmsXaPoolConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory">
<property name="maxConnections" value="${jms.maxConnections}" />
<property name="connectionFactory" ref="jmsXaConnectionFactory" />
<property name="transactionManager" ref="osgiJtaTransactionManager" />
</bean>
<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="${jms.broker.url}"/>
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="-1"/>
<property name="initialRedeliveryDelay" value="2000" />
<property name="redeliveryDelay" value="5000" />
</bean>
</property>
</bean>
A small sample that demonstrates how I'm using the endpoint:
<route id="main-route">
<from uri="jmstx:queue:my-queue" />
<to uri="direct:subroute" />
...
<!-- some logic -->
</route>
<route id="subroute">
<from uri="direct:subroute" />
<transacted ref="PROPAGATION_MANDATORY"/>
...
<!-- Rollback on some condition -->
<rollback/>
...
</route>
Does anyone knows why it happens?
Thank you.
Yes, I encountered same problem.
After hacking the ActiveMQ source code, and adding some logging information, I found some evidences and googled the solution.
Just like the answer said:
https://developer.jboss.org/thread/266172
After setting cacheLevel to CACHE_CONSUMER on the activemq component, solved the problem.
ex:
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsPooledConnectionFactory" />
<property name="concurrentConsumers" value="1"/>
<property name="transacted" value="true"/>
<property name="cacheLevelName" value="CACHE_CONSUMER"/>
<property name="acknowledgementModeName" value="SESSION_TRANSACTED"/>
</bean>

Resources