Codota Logo
PendingConfirm.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.springframework.amqp.rabbit.connection.PendingConfirm
constructor

Best Java code snippets using org.springframework.amqp.rabbit.connection.PendingConfirm.<init> (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-amqp

private void setupConfirm(Channel channel, Message message, @Nullable CorrelationData correlationDataArg) {
  if ((this.publisherConfirms || this.confirmCallback != null) && channel instanceof PublisherCallbackChannel) {
    PublisherCallbackChannel publisherCallbackChannel = (PublisherCallbackChannel) channel;
    CorrelationData correlationData = this.correlationDataPostProcessor != null
        ? this.correlationDataPostProcessor.postProcess(message, correlationDataArg)
        : correlationDataArg;
    long nextPublishSeqNo = channel.getNextPublishSeqNo();
    message.getMessageProperties().setPublishSequenceNumber(nextPublishSeqNo);
    publisherCallbackChannel.addPendingConfirm(this, nextPublishSeqNo,
        new PendingConfirm(correlationData, System.currentTimeMillis()));
    if (correlationData != null && StringUtils.hasText(correlationData.getId())) {
      message.getMessageProperties().setHeader(PublisherCallbackChannel.RETURNED_MESSAGE_CORRELATION_KEY,
          correlationData.getId());
    }
  }
  else if (channel instanceof ChannelProxy && ((ChannelProxy) channel).isConfirmSelected()) {
    long nextPublishSeqNo = channel.getNextPublishSeqNo();
    message.getMessageProperties().setPublishSequenceNumber(nextPublishSeqNo);
  }
}
origin: org.springframework.amqp/spring-rabbit

private void setupConfirm(Channel channel, Message message, @Nullable CorrelationData correlationDataArg) {
  if ((this.publisherConfirms || this.confirmCallback != null) && channel instanceof PublisherCallbackChannel) {
    PublisherCallbackChannel publisherCallbackChannel = (PublisherCallbackChannel) channel;
    CorrelationData correlationData = this.correlationDataPostProcessor != null
        ? this.correlationDataPostProcessor.postProcess(message, correlationDataArg)
        : correlationDataArg;
    long nextPublishSeqNo = channel.getNextPublishSeqNo();
    message.getMessageProperties().setPublishSequenceNumber(nextPublishSeqNo);
    publisherCallbackChannel.addPendingConfirm(this, nextPublishSeqNo,
        new PendingConfirm(correlationData, System.currentTimeMillis()));
    if (correlationData != null && StringUtils.hasText(correlationData.getId())) {
      message.getMessageProperties().setHeader(PublisherCallbackChannel.RETURNED_MESSAGE_CORRELATION_KEY,
          correlationData.getId());
    }
  }
  else if (channel instanceof ChannelProxy && ((ChannelProxy) channel).isConfirmSelected()) {
    long nextPublishSeqNo = channel.getNextPublishSeqNo();
    message.getMessageProperties().setPublishSequenceNumber(nextPublishSeqNo);
  }
}
origin: spring-projects/spring-amqp

@Test
public void testPublisherCallbackChannelImplCloseWithPending() throws Exception {
  Listener listener = mock(Listener.class);
  final CountDownLatch latch = new CountDownLatch(2);
  doAnswer(invocation -> {
    boolean ack = invocation.getArgument(1);
    if (!ack) {
      latch.countDown();
    }
    return null;
  }).when(listener).handleConfirm(any(PendingConfirm.class), anyBoolean());
  when(listener.getUUID()).thenReturn(UUID.randomUUID().toString());
  when(listener.isConfirmListener()).thenReturn(true);
  Channel channelMock = mock(Channel.class);
  PublisherCallbackChannelImpl channel = new PublisherCallbackChannelImpl(channelMock, this.executorService);
  channel.addListener(listener);
  for (int i = 0; i < 2; i++) {
    long seq = i + 1000;
    channel.addPendingConfirm(listener, seq,
        new PendingConfirm(new CorrelationData(Long.toHexString(seq)), System.currentTimeMillis()));
  }
  channel.close();
  assertTrue(latch.await(10, TimeUnit.SECONDS));
  int n = 0;
  while (n++ < 100 && TestUtils.getPropertyValue(channel, "pendingConfirms", Map.class).size() > 0) {
    Thread.sleep(100);
  }
  assertEquals(0, TestUtils.getPropertyValue(channel, "pendingConfirms", Map.class).size());
}
org.springframework.amqp.rabbit.connectionPendingConfirm<init>

Popular methods of PendingConfirm

  • getCause
  • getCorrelationData
    The correlation data supplied by the client when sending the message corresponding to this confirmat
  • getTimestamp
  • setCause
    When the confirmation is nacked, set the cause when available.

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getSystemService (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now