update temporary destination creation to use a bare source and have the link name reflect its use in creating a temp dest and the type thereof
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/4d11d468 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/4d11d468 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/4d11d468 Branch: refs/heads/master Commit: 4d11d4682f5007b4d1760bcfef564b6ac5a34b2f Parents: 4ec9663 Author: Robert Gemmell <[email protected]> Authored: Tue Dec 16 11:15:17 2014 +0000 Committer: Robert Gemmell <[email protected]> Committed: Tue Dec 16 11:15:17 2014 +0000 ---------------------------------------------------------------------- .../provider/amqp/AmqpTemporaryDestination.java | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4d11d468/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java index 10496b0..47c8832 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java @@ -42,6 +42,9 @@ import org.slf4j.LoggerFactory; */ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestination, Sender> { + private static final String TEMP_QUEUE_CREATOR = "temp-queue-creator:"; + private static final String TEMP_TOPIC_CREATOR = "temp-topic-creator:"; + private static final Logger LOG = LoggerFactory.getLogger(AmqpTemporaryDestination.class); private final AmqpConnection connection; @@ -84,26 +87,27 @@ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestinatio @Override protected void doOpen() { - //TODO: debug what this is actually doing, then likely replace with a generated Source name. - String sourceAddress = resource.getName(); - String tempQueuePrefix = "temp-queue://"; + // Form a link name, use the local generated name with a prefix to aid debugging + String localDestinationName = resource.getName(); + String senderLinkName = null; if (resource.isQueue()) { - sourceAddress = tempQueuePrefix + sourceAddress; + senderLinkName = TEMP_QUEUE_CREATOR + localDestinationName; } else { - // TODO - AMQ doesn't support temp topics so we make everything a temp queue for now - sourceAddress = tempQueuePrefix + sourceAddress; + senderLinkName = TEMP_TOPIC_CREATOR + localDestinationName; } + + // Just use a bare Source, this is a producer which + // wont send anything and the link name is unique. Source source = new Source(); - source.setAddress(sourceAddress); Target target = new Target(); target.setDynamic(true); target.setDurable(TerminusDurability.NONE); target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH); - String senderName = sourceAddress; + //TODO: set the dynamic node lifetime-policy - Sender sender = session.getProtonSession().sender(senderName); + Sender sender = session.getProtonSession().sender(senderLinkName); sender.setSource(source); sender.setTarget(target); sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
