You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2014/11/24 18:36:57 UTC
[1/4] qpid-jms git commit: add support for matching Source details on
producing links
Repository: qpid-jms
Updated Branches:
refs/heads/master 381f2397e -> a6d030753
add support for matching Source details on producing links
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/ba46179d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/ba46179d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/ba46179d
Branch: refs/heads/master
Commit: ba46179d26aed5f1b725fa1fae68cee06ba675cb
Parents: 381f239
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Nov 24 12:57:06 2014 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Nov 24 12:57:06 2014 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/ba46179d/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
index 33ba9c7..b7ccfa9 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
@@ -503,13 +503,18 @@ public class TestAmqpPeer implements AutoCloseable
public void expectSenderAttach(final Matcher<?> targetMatcher, final boolean refuseLink, boolean deferAttachResponseWrite)
{
+ expectSenderAttach(notNullValue(), targetMatcher, refuseLink, deferAttachResponseWrite);
+ }
+
+ public void expectSenderAttach(final Matcher<?> sourceMatcher, final Matcher<?> targetMatcher, final boolean refuseLink, boolean deferAttachResponseWrite)
+ {
final AttachMatcher attachMatcher = new AttachMatcher()
.withName(notNullValue())
.withHandle(notNullValue())
.withRole(equalTo(Role.SENDER))
.withSndSettleMode(equalTo(SenderSettleMode.UNSETTLED))
.withRcvSettleMode(equalTo(ReceiverSettleMode.FIRST))
- .withSource(notNullValue())
+ .withSource(sourceMatcher)
.withTarget(targetMatcher);
UnsignedInteger linkHandle = UnsignedInteger.valueOf(_nextLinkHandle++);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/4] qpid-jms git commit: add test to check we specify support of
accepted and rejected outcomes on producing links
Posted by ro...@apache.org.
add test to check we specify support of accepted and rejected outcomes on producing links
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/6b39ddda
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/6b39ddda
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/6b39ddda
Branch: refs/heads/master
Commit: 6b39ddda36706bbaaf97fce0b0d24d80e725403b
Parents: ba46179
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Nov 24 12:57:48 2014 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Nov 24 12:57:48 2014 +0000
----------------------------------------------------------------------
.../jms/integration/SessionIntegrationTest.java | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6b39ddda/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 0f4afae..39bfaf7 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -99,6 +99,32 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
@Test(timeout = 5000)
+ public void testCreateProducerLinkSupportsAcceptedAndRejectedOutcomes() throws Exception {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
+ Connection connection = testFixture.establishConnecton(testPeer);
+ testPeer.expectBegin(true);
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ String queueName = "myQueue";
+
+ SourceMatcher sourceMatcher = new SourceMatcher();
+ sourceMatcher.withOutcomes(arrayContaining(Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL));
+ //TODO: what default outcome for producers?
+ //Accepted normally, Rejected for transaction controller?
+ //sourceMatcher.withDefaultOutcome(outcomeMatcher);
+
+ TargetMatcher targetMatcher = new TargetMatcher();
+ targetMatcher.withAddress(equalTo("queue://" + queueName));
+
+ testPeer.expectSenderAttach(sourceMatcher, targetMatcher, false, false);
+
+ Queue queue = session.createQueue(queueName);
+ session.createProducer(queue);
+ }
+ }
+
+ @Test(timeout = 5000)
public void testCreateConsumer() throws Exception {
try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
Connection connection = testFixture.establishConnecton(testPeer);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/4] qpid-jms git commit: update consumers on transacted sessions to
settle deliveries when transactionally accepting them
Posted by ro...@apache.org.
update consumers on transacted sessions to settle deliveries when transactionally accepting them
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a6d03075
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a6d03075
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a6d03075
Branch: refs/heads/master
Commit: a6d03075362ab58ea125c5d454af6a3dc31015aa
Parents: 1ec620a
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Nov 24 17:09:37 2014 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Nov 24 17:09:37 2014 +0000
----------------------------------------------------------------------
.../org/apache/qpid/jms/JmsMessageConsumer.java | 2 +-
.../qpid/jms/provider/amqp/AmqpConsumer.java | 28 +++++++++++---------
.../jms/integration/SessionIntegrationTest.java | 27 +++++--------------
3 files changed, 23 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a6d03075/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
index 2d9e0ec..632742d 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
@@ -246,7 +246,7 @@ public class JmsMessageConsumer implements MessageConsumer, JmsMessageAvailableC
JmsInboundMessageDispatch ack(final JmsInboundMessageDispatch envelope) throws JMSException {
if (envelope != null && envelope.getMessage() != null) {
JmsMessage message = envelope.getMessage();
- if (message.getAcknowledgeCallback() != null || session.isTransacted()) {
+ if (message.getAcknowledgeCallback() != null) {
// Message has been received by the app.. expand the credit
// window so that we receive more messages.
doAckDelivered(envelope);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a6d03075/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
index e33fddf..c41f5fc 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
@@ -219,16 +219,6 @@ public class AmqpConsumer extends AmqpAbstractResource<JmsConsumerInfo, Receiver
if (ackType.equals(ACK_TYPE.DELIVERED)) {
LOG.debug("Delivered Ack of message: {}", envelope);
- if (session.isTransacted()) {
- Binary txnId = session.getTransactionContext().getAmqpTransactionId();
- if (txnId != null) {
- TransactionalState txState = new TransactionalState();
- txState.setOutcome(Accepted.getInstance());
- txState.setTxnId(txnId);
- delivery.disposition(txState);
- session.getTransactionContext().registerTxConsumer(this);
- }
- }
if (!isPresettle()) {
delivered.put(envelope, delivery);
}
@@ -241,10 +231,24 @@ public class AmqpConsumer extends AmqpAbstractResource<JmsConsumerInfo, Receiver
}
LOG.debug("Consumed Ack of message: {}", envelope);
if (!delivery.isSettled()) {
- delivery.disposition(Accepted.getInstance());
- delivery.settle();
+ if (session.isTransacted()) {
+ Binary txnId = session.getTransactionContext().getAmqpTransactionId();
+ if (txnId != null) {
+ TransactionalState txState = new TransactionalState();
+ txState.setOutcome(Accepted.getInstance());
+ txState.setTxnId(txnId);
+ delivery.disposition(txState);
+ delivery.settle();
+ session.getTransactionContext().registerTxConsumer(this);
+ }
+ } else {
+ delivery.disposition(Accepted.getInstance());
+ delivery.settle();
+ }
}
} else if (ackType.equals(ACK_TYPE.REDELIVERED)) {
+ //TODO: Trace usage of this.
+ //TODO: Don't bother doing anything if it is [remotely]Settled already.
Modified disposition = new Modified();
disposition.setUndeliverableHere(false);
disposition.setDeliveryFailed(true);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a6d03075/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 39bfaf7..a0b0d71 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -434,11 +434,12 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
testPeer.expectTransfer(declareMatcher, false, new Declared().setTxnId(txnId), true);
for (int i = 1; i <= consumeCount; i++) {
- // Then expect an *unsettled* TransactionalState disposition for each message once received by the consumer
+ // Then expect an *settled* TransactionalState disposition for each message once received by the consumer
TransactionalStateMatcher stateMatcher = new TransactionalStateMatcher();
stateMatcher.withTxnId(equalTo(txnId));
stateMatcher.withOutcome(new AcceptedMatcher());
- testPeer.expectDisposition(false, stateMatcher);
+
+ testPeer.expectDisposition(true, stateMatcher);
}
MessageConsumer messageConsumer = session.createConsumer(queue);
@@ -459,14 +460,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
dischargeMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(discharge));
testPeer.expectTransfer(dischargeMatcher, false, new Accepted(), true);
- for (int i = 1; i <= consumeCount; i++) {
- // Then expect a *settled* TransactionalState disposition for each message received by the consumer
- TransactionalStateMatcher stateMatcher = new TransactionalStateMatcher();
- stateMatcher.withTxnId(equalTo(txnId));
- stateMatcher.withOutcome(new AcceptedMatcher());
- testPeer.expectDisposition(true, stateMatcher);
- }
-
session.commit();
testPeer.waitForAllHandlersToComplete(1000);
@@ -506,11 +499,12 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
testPeer.expectTransfer(declareMatcher, false, new Declared().setTxnId(txnId), true);
for (int i = 1; i <= consumeCount; i++) {
- // Then expect a TransactionalState disposition for each message once received by the consumer
+ // Then expect a *settled* TransactionalState disposition for each message once received by the consumer
TransactionalStateMatcher stateMatcher = new TransactionalStateMatcher();
stateMatcher.withTxnId(equalTo(txnId));
stateMatcher.withOutcome(new AcceptedMatcher());
- testPeer.expectDisposition(false, stateMatcher);
+
+ testPeer.expectDisposition(true, stateMatcher);
}
MessageConsumer messageConsumer = session.createConsumer(queue);
@@ -531,15 +525,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
dischargeMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(discharge));
testPeer.expectTransfer(dischargeMatcher, false, new Accepted(), true);
- for (int i = 1; i <= consumeCount; i++) {
- // Then expect a 'Modified' disposition for each message received by the consumer
- // indicating that delivery failed but it can still be consumed.
- ModifiedMatcher modifiedMatcher = new ModifiedMatcher()
- .withDeliveryFailed(equalTo(true))
- .withUndeliverableHere(equalTo(false));
- testPeer.expectDisposition(true, modifiedMatcher);
- }
-
session.rollback();
//TODO: what about messages not received by the consumer?
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/4] qpid-jms git commit: update producer to set supported outcomes
on source
Posted by ro...@apache.org.
update producer to set supported outcomes on source
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/1ec620ae
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/1ec620ae
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/1ec620ae
Branch: refs/heads/master
Commit: 1ec620aec3ef36fd90210600ba13f7ea8e02da8d
Parents: 6b39ddd
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Nov 24 13:09:34 2014 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Nov 24 13:09:34 2014 +0000
----------------------------------------------------------------------
.../org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1ec620ae/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
index 8fbf6ef..4e40a3c 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
@@ -33,9 +33,12 @@ import org.apache.qpid.jms.provider.AsyncResult;
import org.apache.qpid.jms.provider.amqp.message.AmqpJmsMessageFacade;
import org.apache.qpid.jms.util.IOExceptionSupport;
import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.messaging.Accepted;
+import org.apache.qpid.proton.amqp.messaging.Modified;
import org.apache.qpid.proton.amqp.messaging.Outcome;
import org.apache.qpid.proton.amqp.messaging.Rejected;
+import org.apache.qpid.proton.amqp.messaging.Released;
import org.apache.qpid.proton.amqp.messaging.Source;
import org.apache.qpid.proton.amqp.messaging.Target;
import org.apache.qpid.proton.amqp.transaction.TransactionalState;
@@ -240,9 +243,13 @@ public class AmqpFixedProducer extends AmqpProducer {
targetAddress = session.getQualifiedName(destination);
}
+ Symbol[] outcomes = new Symbol[]{Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL};
String sourceAddress = getProducerId().toString();
Source source = new Source();
source.setAddress(sourceAddress);
+ source.setOutcomes(outcomes);
+ //TODO: default outcome. Accepted normally, Rejected for transaction controller?
+
Target target = new Target();
target.setAddress(targetAddress);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org