This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new b3b7329 CAMEL-13773: Remove deprecate batch producer in camel-sjms b3b7329 is described below commit b3b73294a58e8a11f587980e9bd13bb034165412 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Nov 4 06:47:54 2019 +0100 CAMEL-13773: Remove deprecate batch producer in camel-sjms --- .../camel-sjms/src/main/docs/sjms-component.adoc | 148 ++++----------------- .../apache/camel/component/sjms/BatchMessage.java | 100 -------------- .../component/sjms/producer/InOnlyProducer.java | 33 +---- .../sjms/tx/BatchTransactedProducerSupport.java | 133 ------------------ .../sjms/tx/BatchTransactedQueueProducerTest.java | 51 ------- .../sjms/tx/BatchTransactedTopicProducerTest.java | 51 ------- 6 files changed, 30 insertions(+), 486 deletions(-) diff --git a/components/camel-sjms/src/main/docs/sjms-component.adoc b/components/camel-sjms/src/main/docs/sjms-component.adoc index af62569..caecbd2 100644 --- a/components/camel-sjms/src/main/docs/sjms-component.adoc +++ b/components/camel-sjms/src/main/docs/sjms-component.adoc @@ -18,8 +18,8 @@ Additional key features include: * Plugable Connection Resource Management * Session, Consumer, & Producer Pooling & Caching Management -* Batch Consumers and Producers -* Transacted Batch Consumers & Producers +* Batch Consumers +* Transacted Batch Consumers * Support for Customizable Transaction Commit Strategies (Local JMS Transactions only) @@ -46,7 +46,7 @@ for this component: == URI format -[source] +[source,text] ---- sjms:[queue:|topic:]destinationName[?options] ---- @@ -55,14 +55,14 @@ Where `destinationName` is a JMS queue or topic name. By default, the `destinationName` is interpreted as a queue name. For example, to connect to the queue, `FOO.BAR` use: -[source] +[source,text] ---- sjms:FOO.BAR ---- You can include the optional `queue:` prefix, if you prefer: -[source] +[source,text] ---- sjms:queue:FOO.BAR ---- @@ -70,7 +70,7 @@ sjms:queue:FOO.BAR To connect to a topic, you _must_ include the `topic:` prefix. For example, to connect to the topic, `Stocks.Prices`, use: -[source] +[source,text] ---- sjms:topic:Stocks.Prices ---- @@ -80,9 +80,6 @@ You append query options to the URI using the following format, == Component Options and Configurations - - - // component options: START The Simple JMS component supports 15 options, which are listed below. @@ -110,12 +107,6 @@ The Simple JMS component supports 15 options, which are listed below. // component options: END - - - - - - // endpoint options: START The Simple JMS endpoint is configured using URI syntax: @@ -223,10 +214,6 @@ The component supports 16 options, which are listed below. // spring-boot-auto-configure options: END - - - - Below is an example of how to configure the `SjmsComponent` with its required `ConnectionFactory` provider. It will create a single connection by default and store it using the components internal pooling APIs to @@ -293,7 +280,7 @@ from("direct:start") === InOnly Consumer - (Default) -The _InOnly_ xonsumer is the default Exchange behavior of the SJMS +The _InOnly_ consumer is the default Exchange behavior of the SJMS Consumer Endpoint. [source,java] @@ -317,29 +304,22 @@ from("sjms:queue:in.out.test?exchangePattern=InOut") === Plugable Connection Resource Management [[SJMS-connectionresource]] -SJMS provides JMS -http://docs.oracle.com/javaee/5/api/javax/jms/Connection.html[`Connection`] +SJMS provides JMS `Connection` resource management through built-in connection pooling. This eliminates the need to depend on third party API pooling logic. However there may be times that you are required to use an external Connection resource manager such as those provided by J2EE or OSGi containers. For this SJMS provides an interface that can be used to override the internal SJMS -Connection pooling capabilities. This is accomplished through the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java[`ConnectionResource`] -interface. +Connection pooling capabilities. This is accomplished through the `ConnectionResource` interface. -The -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java[`ConnectionResource`] +The `ConnectionResource` provides methods for borrowing and returning Connections as needed is -the contract used to provide -http://docs.oracle.com/javaee/5/api/javax/jms/Connection.html[`Connection`] +the contract used to provide `Connection` pools to the SJMS component. A user should use when it is necessary to integrate SJMS with an external connection pooling manager. -It is recommended though that for standard -http://docs.oracle.com/javaee/5/api/javax/jms/ConnectionFactory.html[`ConnectionFactory`] -providers you use the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/it/ConnectionResourceIT.java[`ConnectionFactoryResource`] +It is recommended though that for standard JMS `ConnectionFactory` +providers you use the `ConnectionFactoryResource` implementation that is provided with SJMS as-is or extend as it is optimized for this component. @@ -394,59 +374,20 @@ component.setConnectionResource(pool); camelContext.addComponent("sjms", component); ---- -To see the full example of its usage please refer to the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/it/ConnectionResourceIT.java[`ConnectionResourceIT`]. - -=== Batch Message Support - -The SjmsProducer supports publishing a collection of messages by -creating an Exchange that encapsulates a `List`. This SjmsProducer will -take then iterate through the contents of the List and publish each -message individually. - -If when producing a batch of messages there is the need to set headers -that are unique to each message you can use the SJMS -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java[`BatchMessage`] -class. When the SjmsProducer encounters a `BatchMessage` list it will -iterate each `BatchMessage` and publish the included payload and headers. - -Below is an example of using the BatchMessage class. First we create a -list of `BatchMessage`: - -[source,java] ----- -List<BatchMessage<String>> messages = new ArrayList<BatchMessage<String>>(); -for (int i = 1; i <= messageCount; i++) { - String body = "Hello World " + i; - BatchMessage<String> message = new BatchMessage<String>(body, null); - messages.add(message); -} ----- - -Then publish the list: - -[source,java] ----- -template.sendBody("sjms:queue:batch.queue", messages); ----- - === Customizable Transaction Commit Strategies (Local JMS Transactions only) SJMS provides a developer the means to create a custom and plugable -transaction strategy through the use of the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java[`TransactionCommitStrategy`] +transaction strategy through the use of the `TransactionCommitStrategy` interface. This allows a user to define a unique set of circumstances -that the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/tx/SessionTransactionSynchronization.java[`SessionTransactionSynchronization`] -will use to determine when to commit the Session. An example of its use -is the -https://svn.apache.org/repos/asf/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/tx/BatchTransactionCommitStrategy.java[`BatchTransactionCommitStrategy`] +that the `SessionTransactionSynchronization` +will use to determine when to commit the Session. +An example of its use is the `BatchTransactionCommitStrategy` which is detailed further in the next section. -=== Transacted Batch Consumers & Producers +=== Transacted Batch Consumers The SJMS component has been designed to support the batching of local JMS -transactions on both the Producer and Consumer endpoints. How they are +transactions on the consumer endpoints. How they are handled on each is very different though. The SJMS consumer endpoint is a straightforward implementation that will @@ -457,7 +398,7 @@ by setting the `transacted` parameter to true and then adding the 0. For example the following configuration will commit the Session every 10 messages: -[source] +[source,text] ---- sjms:queue:transacted.batch.consumer?transacted=true&transactionBatchCount=10 ---- @@ -479,7 +420,7 @@ default value of 5000ms (minimum of 1000ms) should be adequate for most use-cases but if further tuning is necessary simply set the `transactionBatchTimeout` parameter. -[source] +[source,text] ---- sjms:queue:transacted.batch.consumer?transacted=true&transactionBatchCount=10&transactionBatchTimeout=2000 ---- @@ -488,31 +429,6 @@ The minimal value that will be accepted is 1000ms as the amount of context switching may cause unnecessary performance impacts without gaining benefit. -The producer endpoint is handled much differently though. With the -producer after each message is delivered to its destination the Exchange -is closed and there is no longer a reference to that message. To make a -available all the messages available for redelivery you simply enable -transactions on a Producer Endpoint that is publishing BatchMessages. -The transaction will commit at the conclusion of the exchange which -includes all messages in the batch list. Nothing additional need be -configured. For example: - -[source,java] ----- -List<BatchMessage<String>> messages = new ArrayList<BatchMessage<String>>(); -for (int i = 1; i <= messageCount; i++) { - String body = "Hello World " + i; - BatchMessage<String> message = new BatchMessage<String>(body, null); - messages.add(message); -} ----- - -Now publish the List with transactions enabled: - -[source,java] ----- -template.sendBody("sjms:queue:batch.queue?transacted=true", messages); ----- == Additional Notes @@ -534,12 +450,8 @@ messages: ** is replaced by _DOT_ and the reverse replacement when Camel consumes the message. ** is replaced by _HYPHEN_ and the reverse replacement when Camel -consumes the message. + -See also the option `jmsKeyFormatStrategy`, which allows use of your own -custom strategy for formatting keys. - -For the `exchange.in.header`, the following rules apply for the header -values: +consumes the message.See also the option `jmsKeyFormatStrategy`, +which allows use of your own custom strategy for formatting keys. === Message Content @@ -578,17 +490,13 @@ Transaction API (JTA). === Does Springless Mean I Can't Use Spring? -Not at all. Below is an example of the SJMS component using the Spring -DSL: +Not at all. Below is an example of the SJMS component using the Spring XML: -[source,java] +[source,xml] ---- -<route - id="inout.named.reply.to.producer.route"> - <from - uri="direct:invoke.named.reply.to.queue" /> - <to - uri="sjms:queue:named.reply.to.queue?namedReplyTo=my.response.queue&exchangePattern=InOut" /> +<route id="inout.named.reply.to.producer.route"> + <from uri="direct:invoke.named.reply.to.queue" /> + <to uri="sjms:queue:named.reply.to.queue?namedReplyTo=my.response.queue&exchangePattern=InOut" /> </route> ---- diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java deleted file mode 100644 index 0ca66f8..0000000 --- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.sjms; - -import java.util.List; -import java.util.Map; - -/** - * A {@link List} of these objects can be used to batch a collection of bodies and - * header pairs in one exchange. - * <p/> - * <b>Important:</b> This BatchMessage is only supported by <tt>InOnly</tt> messaging style - * (eg you cannot do request/reply with this BatchMessage) - * - * @deprecated do not use, its being removed in a future Camel release - */ -@Deprecated -public class BatchMessage<T> { - private T payload; - private Map<String, Object> headers; - - /** - * @param payload may not be null - * @param headers may be null - */ - public BatchMessage(T payload, Map<String, Object> headers) { - if (payload == null) { - throw new IllegalArgumentException("Payload may not be null"); - } else { - this.payload = payload; - } - this.headers = headers; - } - - public T getPayload() { - return payload; - } - - public Map<String, Object> getHeaders() { - return headers; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((headers == null) ? 0 : headers.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - return result; - } - - @SuppressWarnings("rawtypes") - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof BatchMessage)) { - return false; - } - BatchMessage other = (BatchMessage) obj; - if (headers == null) { - if (other.headers != null) { - return false; - } - } else if (!headers.equals(other.headers)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "BatchMessage [payload=" + payload + ", headers=" + headers + "]"; - } -} diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java index 99a2d2b..eb1f42f 100644 --- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java +++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java @@ -16,17 +16,12 @@ */ package org.apache.camel.component.sjms.producer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - import javax.jms.Message; import org.apache.camel.AsyncCallback; import org.apache.camel.CamelExchangeException; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; -import org.apache.camel.component.sjms.BatchMessage; import org.apache.camel.component.sjms.MessageProducerResources; import org.apache.camel.component.sjms.SjmsProducer; import org.apache.camel.component.sjms.TransactionCommitStrategy; @@ -52,32 +47,8 @@ public class InOnlyProducer extends SjmsProducer { @Override public void sendMessage(final Exchange exchange, final AsyncCallback callback, final MessageProducerResources producer, final ReleaseProducerCallback releaseProducerCallback) throws Exception { try { - Collection<Message> messages = new ArrayList<>(1); - if (exchange.getIn().getBody() != null) { - if (exchange.getIn().getBody() instanceof List) { - Iterable<?> payload = (Iterable<?>) exchange.getIn().getBody(); - for (final Object object : payload) { - Message message; - if (BatchMessage.class.isInstance(object)) { - BatchMessage<?> batchMessage = (BatchMessage<?>) object; - message = getEndpoint().getBinding().makeJmsMessage(exchange, batchMessage.getPayload(), batchMessage.getHeaders(), producer.getSession(), null); - } else { - message = getEndpoint().getBinding().makeJmsMessage(exchange, object, exchange.getIn().getHeaders(), producer.getSession(), null); - } - messages.add(message); - } - } else { - Message message = getEndpoint().getBinding().makeJmsMessage(exchange, producer.getSession()); - messages.add(message); - } - } else { - Message message = getEndpoint().getBinding().makeJmsMessage(exchange, producer.getSession()); - messages.add(message); - } - - for (final Message message : messages) { - producer.getMessageProducer().send(message); - } + Message message = getEndpoint().getBinding().makeJmsMessage(exchange, producer.getSession()); + producer.getMessageProducer().send(message); } catch (Exception e) { exchange.setException(new CamelExchangeException("Unable to complete sending the JMS message", exchange, e)); } finally { diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedProducerSupport.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedProducerSupport.java deleted file mode 100644 index ea796ed..0000000 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedProducerSupport.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.sjms.tx; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.sjms.BatchMessage; -import org.apache.camel.component.sjms.SjmsComponent; -import org.apache.camel.test.junit4.CamelTestSupport; - -public abstract class BatchTransactedProducerSupport extends CamelTestSupport { - - public abstract String getBrokerUri(); - - protected void runTest(String destinationName, int consumerRouteCount, int messageCount, int totalAttempts) - throws Exception { - - // The CountDownLatch is used to make our final assertions await - // unit all the messages have been processed. It is also - // set to time out on the await. Our values are multiplied - // by the number of routes we have. - CountDownLatch latch = new CountDownLatch(totalAttempts + (messageCount * consumerRouteCount)); - addRoute(destinationName, consumerRouteCount, latch); - - // We should see the BatchMessage once in the prebatch and once in the - // redelivery. Then we should see 30 messages arrive in the postbatch. - getMockEndpoint("mock:test.producer").expectedMessageCount(totalAttempts); - for (int i = 1; i <= consumerRouteCount; i++) { - getMockEndpoint("mock:test.consumer." + i).expectedMessageCount(messageCount); - } - - List<BatchMessage<String>> messages = new ArrayList<>(); - for (int i = 1; i <= messageCount; i++) { - String body = "Hello World " + i; - BatchMessage<String> message = new BatchMessage<>(body, null); - messages.add(message); - } - - // First we send the batch to capture the failure. - try { - log.info("Send Messages"); - template.sendBody("direct:start", messages); - } catch (Exception e) { - log.info("Send Again"); - template.sendBody("direct:start", messages); - } - - // Await on our countdown for 10 seconds at most - // then move on - latch.await(10, TimeUnit.SECONDS); - assertMockEndpointsSatisfied(10, TimeUnit.SECONDS); - } - - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext camelContext = super.createCamelContext(); - - ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(getBrokerUri()); - SjmsComponent component = new SjmsComponent(); - component.setConnectionFactory(connectionFactory); - camelContext.addComponent("sjms", component); - - return camelContext; - } - - protected void addRoute(final String destinationName, final int consumerRouteCount, final CountDownLatch latch) throws Exception { - context.addRoutes(new RouteBuilder() { - @Override - public void configure() { - - from("direct:start") - .id("producer.route") - .log("Producer Route Body: ${body}") - .to("mock:test.producer") - .to(destinationName + "?transacted=true") - // This Processor will force an exception to occur on the exchange - .process(new Processor() { - private final AtomicInteger counter = new AtomicInteger(0); - @Override - public void process(Exchange exchange) throws Exception { - - // Only throw the exception the first time around. - // Otherwise allow it to proceed. - if (counter.getAndIncrement() == 0) { - log.info("BatchMessage received without redelivery. Rolling back."); - exchange.setException(new Exception()); - } - // Countdown the latch - latch.countDown(); - } - }); - - for (int i = 1; i <= consumerRouteCount; i++) { - from(destinationName) - .id("consumer.route." + i) - .log("Consumer Route " + i + " Body: ${body}") - .to("mock:test.consumer." + i) - .process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - - // Countdown the latch - latch.countDown(); - } - }); - } - } - }); - } -} diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedQueueProducerTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedQueueProducerTest.java deleted file mode 100644 index 6e1c762..0000000 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedQueueProducerTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.sjms.tx; - -import org.apache.camel.component.sjms.BatchMessage; -import org.junit.Test; - -/** - * Test used to verify the batch transaction capability of the SJMS Component - * for a Queue Producer. - */ -public class BatchTransactedQueueProducerTest extends BatchTransactedProducerSupport { - private static final String BROKER_URI = "vm://btqpt_test_broker?broker.persistent=false&broker.useJmx=false"; - - /** - * Verify that after processing a {@link BatchMessage} twice with 30 - * messages in for a total of 60 delivery attempts that we only see 30 - * messages end up at the final consumer. This is due to an exception being - * thrown during the processing of the first 30 messages which causes a - * redelivery. - * - * @throws Exception - */ - @Test - public void testRoute() throws Exception { - final String destinationName = "sjms:queue:one.consumer.one.route.batch.tx.test"; - int consumerRouteCount = 1; - int messageCount = 20; - int totalAttempts = 2; - runTest(destinationName, consumerRouteCount, messageCount, totalAttempts); - } - - @Override - public String getBrokerUri() { - return BROKER_URI; - } -} diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedTopicProducerTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedTopicProducerTest.java deleted file mode 100644 index e259f2c..0000000 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/BatchTransactedTopicProducerTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.sjms.tx; - -import org.apache.camel.component.sjms.BatchMessage; -import org.junit.Test; - -/** - * Test used to verify the batch transaction capability of the SJMS Component - * for a Topic Producer. - */ -public class BatchTransactedTopicProducerTest extends BatchTransactedProducerSupport { - private static final String BROKER_URI = "vm://bttpt_test_broker?broker.persistent=false&broker.useJmx=false"; - - /** - * Verify that after processing a {@link BatchMessage} twice with 30 - * messages in for a total of 60 delivery attempts that we only see 30 - * messages end up at the final consumer. This is due to an exception being - * thrown during the processing of the first 30 messages which causes a - * redelivery. - * - * @throws Exception - */ - @Test - public void testRoute() throws Exception { - final String destinationName = "sjms:topic:one.consumer.two.route.batch.tx.test"; - int consumerRouteCount = 2; - int messageCount = 20; - int totalAttempts = 2; - runTest(destinationName, consumerRouteCount, messageCount, totalAttempts); - } - - @Override - public String getBrokerUri() { - return BROKER_URI; - } -}