org.apache.qpid.proton.amqp.messaging.Target Java Examples

The following examples show how to use org.apache.qpid.proton.amqp.messaging.Target. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AmqpSession.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a sender instance using the given Target
 *
 * @param target the caller created and configured Target used to create the sender link.
 * @param senderId the sender ID to assign to the newly created Sender.
 * @param desiredCapabilities the capabilities that the caller wants the remote to support.
 * @param offeredCapabilities the capabilities that the caller wants the advertise support for.
 * @param properties the properties to send as part of the sender open.
 * @return a newly created sender that is ready for use.
 * @throws Exception if an error occurs while creating the receiver.
 */
public AmqpSender createSender(Target target, String senderId, Symbol[] desiredCapabilities, Symbol[] offeredCapabilities, Map<Symbol, Object> properties) throws Exception {
   checkClosed();

   final AmqpSender sender = new AmqpSender(AmqpSession.this, target, senderId);
   sender.setDesiredCapabilities(desiredCapabilities);
   sender.setOfferedCapabilities(offeredCapabilities);
   sender.setProperties(properties);
   final ClientFuture request = new ClientFuture();

   connection.getScheduler().execute(new Runnable() {

      @Override
      public void run() {
         checkClosed();
         sender.setStateInspector(getStateInspector());
         sender.open(request);
         pumpToProtonTransport(request);
      }
   });

   request.sync();

   return sender;
}
 
Example #2
Source File: AmqpTempDestinationTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
protected void doTestDynamicSenderLifetimeBoundToLinkQueue(boolean topic) throws Exception {
   Target target = createDynamicTarget(topic);

   AmqpClient client = createAmqpClient();
   AmqpConnection connection = addConnection(client.connect());
   AmqpSession session = connection.createSession();

   AmqpSender sender = session.createSender(target);
   assertNotNull(sender);

   Target remoteTarget = (Target) sender.getEndpoint().getRemoteTarget();
   Queue queueView = getProxyToQueue(remoteTarget.getAddress());
   assertNotNull(queueView);

   sender.close();

   queueView = getProxyToQueue(remoteTarget.getAddress());
   assertNull(queueView);

   connection.close();
}
 
Example #3
Source File: AmqpTempDestinationTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected void doTestCreateDynamicSender(boolean topic) throws Exception {
   Target target = createDynamicTarget(topic);

   AmqpClient client = createAmqpClient();
   AmqpConnection connection = addConnection(client.connect());
   AmqpSession session = connection.createSession();

   AmqpSender sender = session.createSender(target);
   assertNotNull(sender);

   Target remoteTarget = (Target) sender.getEndpoint().getRemoteTarget();
   assertTrue(remoteTarget.getDynamic());
   assertTrue(remoteTarget.getDurable().equals(TerminusDurability.NONE));
   assertTrue(remoteTarget.getExpiryPolicy().equals(TerminusExpiryPolicy.LINK_DETACH));

   // Check the dynamic node lifetime-policy
   Map<Symbol, Object> dynamicNodeProperties = remoteTarget.getDynamicNodeProperties();
   assertTrue(dynamicNodeProperties.containsKey(LIFETIME_POLICY));
   assertEquals(DeleteOnClose.getInstance(), dynamicNodeProperties.get(LIFETIME_POLICY));

   Queue queueView = getProxyToQueue(remoteTarget.getAddress());
   assertNotNull(queueView);

   connection.close();
}
 
Example #4
Source File: AmqpClientTestSupport.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
protected Target createDynamicTarget(boolean topic) {

      Target target = new Target();
      target.setDynamic(true);
      target.setDurable(TerminusDurability.NONE);
      target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);

      // Set the dynamic node lifetime-policy
      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
      target.setDynamicNodeProperties(dynamicNodeProperties);

      // Set the capability to indicate the node type being created
      if (!topic) {
         target.setCapabilities(TEMP_QUEUE_CAPABILITY);
      } else {
         target.setCapabilities(TEMP_TOPIC_CAPABILITY);
      }

      return target;
   }
 
Example #5
Source File: HonoConnectionImplTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Verifies that the attempt to create a sender fails with a
 * {@code ServerErrorException} if the connection gets disconnected
 * before the remote peer has sent its attach frame. It is verified
 * that this is done before the link establishment timeout.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testCreateSenderFailsOnDisconnectBeforeOpen(final VertxTestContext ctx) {
    final long linkEstablishmentTimeout = 444L; // choose a distinct value here
    props.setLinkEstablishmentTimeout(linkEstablishmentTimeout);
    // don't run linkEstablishmentTimeout timer handler
    when(vertx.setTimer(eq(linkEstablishmentTimeout), VertxMockSupport.anyHandler())).thenAnswer(invocation -> 0L);

    final ProtonSender sender = mock(ProtonSender.class);
    when(sender.isOpen()).thenReturn(Boolean.TRUE);
    when(con.createSender(anyString())).thenReturn(sender);
    final Target target = new Target();
    target.setAddress("someAddress");
    when(sender.getRemoteTarget()).thenReturn(target);
    when(sender.getCredit()).thenReturn(0);
    // mock handlers
    final Handler<String> remoteCloseHook = VertxMockSupport.mockHandler();

    // GIVEN an established connection
    honoConnection.connect()
        .compose(c -> {
            // WHEN creating a sender link with a close hook
            final Future<ProtonSender> result = honoConnection.createSender(
                    "target", ProtonQoS.AT_LEAST_ONCE, remoteCloseHook);
            // THEN the result is not completed at first
            ctx.verify(() -> assertThat(result.isComplete()).isFalse());
            // WHEN the downstream connection fails
            connectionFactory.getDisconnectHandler().handle(con);
            return result;
        })
        // THEN the attempt is failed
        .onComplete(ctx.failing(t -> {
            ctx.verify(() -> assertThat(((ServerErrorException) t).getErrorCode()).isEqualTo(HttpURLConnection.HTTP_UNAVAILABLE));
            ctx.completeNow();
        }));
}
 
Example #6
Source File: AmqpProducerBuilder.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
protected ProviderException getDefaultOpenAbortException() {
    // Verify the attach response contained a non-null target
    org.apache.qpid.proton.amqp.transport.Target target = getEndpoint().getRemoteTarget();
    if (target != null) {
        return super.getDefaultOpenAbortException();
    } else {
        // No link terminus was created, the peer has detach/closed us, create IDE.
        return new ProviderInvalidDestinationException("Link creation was refused");
    }
}
 
Example #7
Source File: AmqpProducerBuilder.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
protected Sender createEndpoint(JmsProducerInfo resourceInfo) {
    JmsDestination destination = resourceInfo.getDestination();
    AmqpConnection connection = getParent().getConnection();

    String targetAddress = AmqpDestinationHelper.getDestinationAddress(destination, connection);

    Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
    String sourceAddress = resourceInfo.getId().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);
    Symbol typeCapability =  AmqpDestinationHelper.toTypeCapability(destination);
    if (typeCapability != null) {
        target.setCapabilities(typeCapability);
    }

    String senderName = "qpid-jms:sender:" + sourceAddress + ":" + targetAddress;

    Sender sender = getParent().getEndpoint().sender(senderName);
    sender.setSource(source);
    sender.setTarget(target);
    if (resourceInfo.isPresettle()) {
        sender.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (!connection.getProperties().isDelayedDeliverySupported()) {
        validateDelayedDeliveryLinkCapability = true;
        sender.setDesiredCapabilities(new Symbol[] { AmqpSupport.DELAYED_DELIVERY });
    }

    return sender;
}
 
Example #8
Source File: AmqpTemporaryDestinationBuilder.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
protected Sender createEndpoint(JmsTemporaryDestination resourceInfo) {
    // Form a link name, use the local generated name with a prefix to aid debugging
    String localDestinationName = resourceInfo.getAddress();
    String senderLinkName = null;
    if (resourceInfo.isQueue()) {
        senderLinkName = "qpid-jms:" + TEMP_QUEUE_CREATOR + localDestinationName;
    } else {
        senderLinkName = "qpid-jms:" + 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();

    Target target = new Target();
    target.setDynamic(true);
    target.setDurable(TerminusDurability.NONE);
    target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);

    // Set the dynamic node lifetime-policy
    Map<Symbol, Object> dynamicNodeProperties = new HashMap<Symbol, Object>();
    dynamicNodeProperties.put(DYNAMIC_NODE_LIFETIME_POLICY, DeleteOnClose.getInstance());
    target.setDynamicNodeProperties(dynamicNodeProperties);

    // Set the capability to indicate the node type being created
    if (resourceInfo.isQueue()) {
        target.setCapabilities(AmqpDestinationHelper.TEMP_QUEUE_CAPABILITY);
    } else {
        target.setCapabilities(AmqpDestinationHelper.TEMP_TOPIC_CAPABILITY);
    }

    Sender sender = getParent().getEndpoint().sender(senderLinkName);
    sender.setSource(source);
    sender.setTarget(target);
    sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    return sender;
}
 
Example #9
Source File: AmqpConnectionSession.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
protected Receiver createEndpoint(JmsSessionInfo resourceInfo) {
    Receiver receiver = getParent().getEndpoint().receiver(linkName);
    receiver.setTarget(new Target());
    receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (!hasClientID) {
      // We are trying to unsubscribe a 'global' shared subs using a 'null source lookup', add link
      // desired capabilities as hints to the peer to consider this when trying to attach the link.
      receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED, AmqpSupport.GLOBAL });
    }

    return receiver;
}
 
Example #10
Source File: ProtonSessionImpl.java    From vertx-proton with Apache License 2.0 5 votes vote down vote up
@Override
public ProtonSender createSender(String address, ProtonLinkOptions senderOptions) {
  Sender sender = session.sender(getOrCreateLinkName(senderOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
  Source source = new Source();
  source.setOutcomes(outcomes);

  Target target = new Target();
  target.setAddress(address);
  if(senderOptions.isDynamic()) {
    target.setDynamic(true);
  }

  sender.setSource(source);
  sender.setTarget(target);

  ProtonSenderImpl s = new ProtonSenderImpl(sender);
  if (address == null) {
    s.setAnonymousSender(true);
  }

  s.openHandler((result) -> {
    LOG.trace("Sender open completed");
  });
  s.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Sender closed");
    } else {
      LOG.warn("Sender closed with error", result.cause());
    }
  });

  // Default to at-least-once
  s.setQoS(ProtonQoS.AT_LEAST_ONCE);

  return s;
}
 
Example #11
Source File: ProtonSessionImpl.java    From vertx-proton with Apache License 2.0 5 votes vote down vote up
@Override
public ProtonReceiver createReceiver(String address, ProtonLinkOptions receiverOptions) {
  Receiver receiver = session.receiver(getOrCreateLinkName(receiverOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };

  Source source = new Source();
  source.setAddress(address);
  source.setOutcomes(outcomes);
  source.setDefaultOutcome(Released.getInstance());
  if(receiverOptions.isDynamic()) {
    source.setDynamic(true);
  }

  Target target = new Target();

  receiver.setSource(source);
  receiver.setTarget(target);

  ProtonReceiverImpl r = new ProtonReceiverImpl(receiver);
  r.openHandler((result) -> {
    LOG.trace("Receiver open completed");
  });
  r.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Receiver closed");
    } else {
      LOG.warn("Receiver closed with error", result.cause());
    }
  });

  // Default to at-least-once
  r.setQoS(ProtonQoS.AT_LEAST_ONCE);

  return r;
}
 
Example #12
Source File: AmqpSender.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected Exception getOpenAbortException() {
   // Verify the attach response contained a non-null target
   org.apache.qpid.proton.amqp.transport.Target t = getEndpoint().getRemoteTarget();
   if (t != null) {
      return super.getOpenAbortException();
   } else {
      // No link terminus was created, the peer has detach/closed us, create IDE.
      return new InvalidDestinationException("Link creation was refused");
   }
}
 
Example #13
Source File: AmqpSender.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void doOpenCompletion() {
   // Verify the attach response contained a non-null target
   org.apache.qpid.proton.amqp.transport.Target t = getEndpoint().getRemoteTarget();
   if (t != null) {
      super.doOpenCompletion();
   } else {
      // No link terminus was created, the peer will now detach/close us.
   }
}
 
Example #14
Source File: AmqpSender.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new sender instance using the given Target when creating the link.
 *
 * @param session
 *        The parent session that created the session.
 * @param target
 *        The target that this sender produces to.
 * @param senderId
 *        The unique ID assigned to this sender.
 */
public AmqpSender(AmqpSession session, Target target, String senderId) {

   if (target == null) {
      throw new IllegalArgumentException("User specified Target cannot be null");
   }

   this.session = session;
   this.address = target.getAddress();
   this.senderId = senderId;
   this.userSpecifiedTarget = target;
   this.userSpecifiedSenderSettlementMode = null;
   this.userSpecifiedReceiverSettlementMode = null;
   outcomes = DEFAULT_OUTCOMES;
}
 
Example #15
Source File: AmqpTempDestinationTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void doTestCreateDynamicSenderAndPublish(boolean topic) throws Exception {
   Target target = createDynamicTarget(topic);

   AmqpClient client = createAmqpClient();
   AmqpConnection connection = addConnection(client.connect());
   AmqpSession session = connection.createSession();

   AmqpSender sender = session.createSender(target);
   assertNotNull(sender);

   Target remoteTarget = (Target) sender.getEndpoint().getRemoteTarget();
   Queue queueView = getProxyToQueue(remoteTarget.getAddress());
   assertNotNull(queueView);

   // Get the new address
   String address = sender.getSender().getRemoteTarget().getAddress();
   LOG.debug("New dynamic sender address -> {}", address);

   // Create a message and send to a receive that is listening on the newly
   // created dynamic link address.
   AmqpMessage message = new AmqpMessage();
   message.setMessageId("msg-1");
   message.setText("Test-Message");

   AmqpReceiver receiver = session.createReceiver(address);
   receiver.flow(1);

   sender.send(message);

   AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
   assertNotNull("Should have read a message", received);
   received.accept();

   receiver.close();
   sender.close();

   connection.close();
}
 
Example #16
Source File: HonoConnectionImplTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Verifies that the attempt to create a sender succeeds when sender never gets credits.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testCreateSenderThatGetsNoCredits(final VertxTestContext ctx) {
    final ProtonSender sender = mock(ProtonSender.class);
    when(sender.isOpen()).thenReturn(Boolean.TRUE);
    when(con.createSender(anyString())).thenReturn(sender);
    final Target target = new Target();
    target.setAddress("someAddress");
    when(sender.getRemoteTarget()).thenReturn(target);
    when(sender.getCredit()).thenReturn(0);
    // just invoke openHandler with succeeded future
    doAnswer(AdditionalAnswers.answerVoid(
            (final Handler<AsyncResult<ProtonSender>> handler) -> handler.handle(Future.succeededFuture(sender))))
                    .when(sender).openHandler(VertxMockSupport.anyHandler());
    final Handler<String> remoteCloseHook = VertxMockSupport.mockHandler();

    // GIVEN an established connection
    honoConnection.connect()
        .compose(c -> honoConnection.createSender(
            "target", ProtonQoS.AT_LEAST_ONCE, remoteCloseHook))
        .onComplete(ctx.succeeding(s -> {
                ctx.verify(() -> {
                    assertThat(s).isEqualTo(sender);
                    // sendQueueDrainHandler gets unset
                    verify(sender).sendQueueDrainHandler(null);
                });
                ctx.completeNow();
            }));
}
 
Example #17
Source File: Pool.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public Receiver newIncoming(Session ssn, String remote, String local) {
    Receiver rcv = ssn.receiver(String.format("%s-%s", remote, local));
    Source src = new Source();
    src.setAddress(remote);
    rcv.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    rcv.setTarget(tgt);
    return rcv;
}
 
Example #18
Source File: Pool.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public Sender newOutgoing(Session ssn, String remote, String local) {
    Sender snd = ssn.sender(String.format("%s-%s", local, remote));
    Source src = new Source();
    src.setAddress(local);
    snd.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    snd.setTarget(tgt);
    return snd;
}
 
Example #19
Source File: AmqpClient.java    From enmasse with Apache License 2.0 5 votes vote down vote up
public ReceiverStatus recvMessages(Source source, Predicate<Message> done, Optional<String> linkName, DeliveryHandler deliveryHandler) {
    CompletableFuture<List<Message>> resultPromise = new CompletableFuture<>();

    Vertx vertx = VertxFactory.create();
    clients.add(vertx);
    String containerId = "systemtest-receiver-" + source.getAddress();
    CompletableFuture<Void> connectPromise = new CompletableFuture<>();
    Receiver receiver = new Receiver(options, done, new LinkOptions(source, new Target(), linkName), connectPromise, resultPromise, containerId, deliveryHandler);
    vertx.deployVerticle(receiver);
    try {
        connectPromise.get(2, TimeUnit.MINUTES);
    } catch (Exception e) {
        resultPromise.completeExceptionally(e);
    }
    return new ReceiverStatus() {
        @Override
        public Future<List<Message>> getResult() {
            return resultPromise;
        }

        @Override
        public int getNumReceived() {
            return receiver.getNumReceived();
        }

        @Override
        public void close() throws Exception {
            clients.remove(vertx);
            closeVertxAndWait(Arrays.asList(vertx));
        }

        @Override
        public void closeGracefully() {
            receiver.closeGracefully();
        }
    };
}
 
Example #20
Source File: TargetType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
public Class<Target> getTypeClass()
{
    return Target.class;
}
 
Example #21
Source File: VertxBasedAmqpProtocolAdapterTest.java    From hono with Eclipse Public License 2.0 4 votes vote down vote up
private Target getTarget(final ResourceIdentifier resource) {
    final Target target = new Target();
    target.setAddress(resource.toString());
    return target;
}
 
Example #22
Source File: VertxBasedAmqpProtocolAdapterTest.java    From hono with Eclipse Public License 2.0 4 votes vote down vote up
private ProtonReceiver getReceiver(final ProtonQoS qos, final Target target) {
    final ProtonReceiver receiver = mock(ProtonReceiver.class);
    when(receiver.getRemoteTarget()).thenReturn(target);
    when(receiver.getRemoteQoS()).thenReturn(qos);
    return receiver;
}
 
Example #23
Source File: AmqpConsumerBuilder.java    From qpid-jms with Apache License 2.0 4 votes vote down vote up
@Override
protected Receiver createEndpoint(JmsConsumerInfo resourceInfo) {
    JmsDestination destination = resourceInfo.getDestination();
    String address = AmqpDestinationHelper.getDestinationAddress(destination, getParent().getConnection());

    Source source = new Source();
    source.setAddress(address);
    Target target = new Target();

    configureSource(source);

    String receiverLinkName = null;
    String subscriptionName = resourceInfo.getSubscriptionName();
    if (subscriptionName != null && !subscriptionName.isEmpty()) {
        AmqpConnection connection = getParent().getConnection();

        if (resourceInfo.isShared() && !connection.getProperties().isSharedSubsSupported()) {
            validateSharedSubsLinkCapability = true;
        }

        AmqpSubscriptionTracker subTracker = connection.getSubTracker();

        // Validate subscriber type allowed given existing active subscriber types.
        if (resourceInfo.isShared() && resourceInfo.isDurable()) {
            if(subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
                // Don't allow shared sub if there is already an active exclusive durable sub
                throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
            }
        } else if (!resourceInfo.isShared() && resourceInfo.isDurable()) {
            if (subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
                // Exclusive durable sub is already active
                throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
            } else if (subTracker.isActiveSharedDurableSub(subscriptionName)) {
                // Don't allow exclusive durable sub if there is already an active shared durable sub
                throw new JMSRuntimeException("A shared durable subscription is already active with name '" + subscriptionName + "'");
            }
        }

        // Get the link name for the subscription. Throws if certain further validations fail.
        receiverLinkName = subTracker.reserveNextSubscriptionLinkName(subscriptionName, resourceInfo);
    }

    if (receiverLinkName == null) {
        receiverLinkName = "qpid-jms:receiver:" + resourceInfo.getId() + ":" + address;
    }

    Receiver receiver = getParent().getEndpoint().receiver(receiverLinkName);
    receiver.setSource(source);
    receiver.setTarget(target);
    if (resourceInfo.isBrowser() || resourceInfo.isPresettle()) {
        receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (validateSharedSubsLinkCapability) {
        receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED_SUBS });
    }

    return receiver;
}
 
Example #24
Source File: QueueTerminusFactory.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
public Target getTarget(String address) {
    Target target = new Target();
    target.setAddress(address);
    return target;
}
 
Example #25
Source File: TopicTerminusFactory.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
public Target getTarget(String address) {
    Target target = super.getTarget(address);
    target.setCapabilities(Symbol.getSymbol("topic"));
    return target;
}
 
Example #26
Source File: LinkOptions.java    From enmasse with Apache License 2.0 4 votes vote down vote up
public LinkOptions(Source source, Target target, Optional<String> linkName) {
    this.source = source;
    this.target = target;
    this.linkName = linkName;
}
 
Example #27
Source File: LinkOptions.java    From enmasse with Apache License 2.0 4 votes vote down vote up
public Target getTarget() {
    return target;
}
 
Example #28
Source File: DurableTopicTerminusFactory.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
public Target getTarget(String address) {
    Target target = super.getTarget(address);
    target.setDurable(TerminusDurability.UNSETTLED_STATE);
    return target;
}
 
Example #29
Source File: TargetType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
@Override
protected List wrap(Target val)
{
    return new TargetWrapper(val);
}
 
Example #30
Source File: TargetType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
public TargetWrapper(Target impl)
{
    _impl = impl;
}