Examples of ConfirmCallback


Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

  @Test
  public void testPublisherConfirmReceivedTwoTemplates() throws Exception {
    final CountDownLatch latch1 = new CountDownLatch(1);
    final CountDownLatch latch2 = new CountDownLatch(1);
    templateWithConfirmsEnabled.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        latch1.countDown();
      }
    });
    templateWithConfirmsEnabled.convertAndSend(ROUTE, (Object) "message", new CorrelationData("abc"));
    RabbitTemplate secondTemplate = new RabbitTemplate(connectionFactoryWithConfirmsEnabled);
    secondTemplate.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        latch2.countDown();
      }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final AtomicBoolean confirmed = new AtomicBoolean();
    template.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        confirmed.set(true);
      }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    ccf.setPublisherConfirms(true);
    ccf.setChannelCacheSize(3);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final AtomicBoolean confirmed = new AtomicBoolean();
    template.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        confirmed.set(true);
      }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final AtomicBoolean confirmed = new AtomicBoolean();
    template.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        confirmed.set(true);
      }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final CountDownLatch latch = new CountDownLatch(2);
    template.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        if (ack) {
          latch.countDown();
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    ccf.setPublisherConfirms(true);
    final RabbitTemplate template1 = new RabbitTemplate(ccf);

    final Set<String> confirms = new HashSet<String>();
    final CountDownLatch latch1 = new CountDownLatch(1);
    template1.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        if (ack) {
          confirms.add(correlationData.getId() + "1");
          latch1.countDown();
        }
      }
    });
    final RabbitTemplate template2 = new RabbitTemplate(ccf);

    final CountDownLatch latch2 = new CountDownLatch(1);
    template2.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        if (ack) {
          confirms.add(correlationData.getId() + "2");
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

    final CountDownLatch delayAckProcessingLatch = new CountDownLatch(1);
    final CountDownLatch startedProcessingMultiAcksLatch = new CountDownLatch(1);
    final CountDownLatch waitForAll3AcksLatch = new CountDownLatch(3);
    final CountDownLatch allSentLatch = new CountDownLatch(1);
    final AtomicInteger acks = new AtomicInteger();
    template.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        try {
          startedProcessingMultiAcksLatch.countDown();
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

  public void testNackForBadExchange() throws Exception {
    final AtomicBoolean nack = new AtomicBoolean(true);
    final AtomicReference<CorrelationData> correlation = new AtomicReference<CorrelationData>();
    final AtomicReference<String> reason = new AtomicReference<String>();
    final CountDownLatch latch = new CountDownLatch(2);
    this.templateWithConfirmsEnabled.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        nack.set(ack);
        correlation.set(correlationData);
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback

  }

  @Test
  public void testConfirmReceivedAfterPublisherCallbackChannelScheduleClose() throws Exception {
    final CountDownLatch latch = new CountDownLatch(40);
    templateWithConfirmsEnabled.setConfirmCallback(new ConfirmCallback() {

      @Override
      public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        latch.countDown();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.