Tabnine Logo
AsyncRabbitTemplate$RabbitMessageFuture
Code IndexAdd Tabnine to your IDE (free)

How to use
AsyncRabbitTemplate$RabbitMessageFuture
in
org.springframework.amqp.rabbit

Best Java code snippets using org.springframework.amqp.rabbit.AsyncRabbitTemplate$RabbitMessageFuture (Showing top 12 results out of 315)

origin: spring-projects/spring-integration

RabbitMessageFuture future = asyncTemplate.new RabbitMessageFuture(null, null);
willReturn(future).given(asyncTemplate).sendAndReceive(anyString(), anyString(),
    any(org.springframework.amqp.core.Message.class));
origin: spring-projects/spring-integration

@Override
public void onSuccess(Boolean result) {
  try {
    handleConfirm(this.correlationData, result, this.replyFuture.getNackCause());
  }
  catch (Exception e) {
    logger.error("Failed to send publisher confirm");
  }
}
origin: org.springframework.amqp/spring-rabbit

((RabbitMessageFuture) future).set(message);
origin: spring-projects/spring-amqp

((RabbitMessageFuture) future).set(message);
origin: org.springframework.amqp/spring-rabbit

@Override
public RabbitMessageFuture sendAndReceive(String exchange, String routingKey, Message message) {
  String correlationId = getOrSetCorrelationIdAndSetReplyTo(message);
  RabbitMessageFuture future = new RabbitMessageFuture(correlationId, message);
  CorrelationData correlationData = null;
  if (this.enableConfirms) {
    correlationData = new CorrelationData(correlationId);
    future.setConfirm(new SettableListenableFuture<>());
  }
  this.pending.put(correlationId, future);
  if (this.container != null) {
    this.template.send(exchange, routingKey, message, correlationData);
  }
  else {
    ChannelHolder channelHolder = this.directReplyToContainer.getChannelHolder();
    future.setChannelHolder(channelHolder);
    sendDirect(channelHolder.getChannel(), exchange, routingKey, message, correlationData);
  }
  future.startTimer();
  return future;
}
origin: spring-projects/spring-amqp

@Override
public RabbitMessageFuture sendAndReceive(String exchange, String routingKey, Message message) {
  String correlationId = getOrSetCorrelationIdAndSetReplyTo(message);
  RabbitMessageFuture future = new RabbitMessageFuture(correlationId, message);
  CorrelationData correlationData = null;
  if (this.enableConfirms) {
    correlationData = new CorrelationData(correlationId);
    future.setConfirm(new SettableListenableFuture<>());
  }
  this.pending.put(correlationId, future);
  if (this.container != null) {
    this.template.send(exchange, routingKey, message, correlationData);
  }
  else {
    ChannelHolder channelHolder = this.directReplyToContainer.getChannelHolder();
    future.setChannelHolder(channelHolder);
    sendDirect(channelHolder.getChannel(), exchange, routingKey, message, correlationData);
  }
  future.startTimer();
  return future;
}
origin: org.springframework.integration/spring-integration-amqp

@Override
protected Object handleRequestMessage(Message<?> requestMessage) {
  org.springframework.amqp.core.Message amqpMessage = MappingUtils.mapMessage(requestMessage,
      this.messageConverter, getHeaderMapper(), getDefaultDeliveryMode(), isHeadersMappedLast());
  addDelayProperty(requestMessage, amqpMessage);
  RabbitMessageFuture future = this.template.sendAndReceive(generateExchangeName(requestMessage),
      generateRoutingKey(requestMessage), amqpMessage);
  future.addCallback(new FutureCallback(requestMessage));
  CorrelationData correlationData = generateCorrelationData(requestMessage);
  if (correlationData != null && future.getConfirm() != null) {
    future.getConfirm().addCallback(new CorrelationCallback(correlationData, future));
  }
  return null;
}
origin: org.springframework.integration/spring-integration-amqp

@Override
public void onSuccess(Boolean result) {
  try {
    handleConfirm(this.correlationData, result, this.replyFuture.getNackCause());
  }
  catch (Exception e) {
    logger.error("Failed to send publisher confirm");
  }
}
origin: spring-projects/spring-amqp

@Test
@DirtiesContext
public void testMessageWithConfirm() throws Exception {
  this.asyncTemplate.setEnableConfirms(true);
  RabbitMessageFuture future = this.asyncTemplate
      .sendAndReceive(new SimpleMessageConverter().toMessage("sleep", new MessageProperties()));
  ListenableFuture<Boolean> confirm = future.getConfirm();
  assertNotNull(confirm);
  assertTrue(confirm.get(10, TimeUnit.SECONDS));
  checkMessageResult(future, "SLEEP");
}
origin: spring-projects/spring-amqp

@Test
@DirtiesContext
public void testMessageWithConfirmDirect() throws Exception {
  this.asyncDirectTemplate.setEnableConfirms(true);
  RabbitMessageFuture future = this.asyncDirectTemplate
      .sendAndReceive(new SimpleMessageConverter().toMessage("sleep", new MessageProperties()));
  ListenableFuture<Boolean> confirm = future.getConfirm();
  assertNotNull(confirm);
  assertTrue(confirm.get(10, TimeUnit.SECONDS));
  checkMessageResult(future, "SLEEP");
}
origin: spring-projects/spring-integration

@Test
public void testAsyncDelayExpression() {
  ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
  AsyncRabbitTemplate amqpTemplate = spy(new AsyncRabbitTemplate(new RabbitTemplate(connectionFactory),
      new SimpleMessageListenerContainer(connectionFactory), "replyTo"));
  amqpTemplate.setTaskScheduler(mock(TaskScheduler.class));
  AsyncAmqpOutboundGateway gateway = new AsyncAmqpOutboundGateway(amqpTemplate);
  willAnswer(
      invocation -> amqpTemplate.new RabbitMessageFuture("foo", invocation.getArgument(2)))
        .given(amqpTemplate).sendAndReceive(anyString(), anyString(), any(Message.class));
  gateway.setExchangeName("foo");
  gateway.setRoutingKey("bar");
  gateway.setDelayExpressionString("42");
  gateway.setBeanFactory(mock(BeanFactory.class));
  gateway.setOutputChannel(new NullChannel());
  gateway.afterPropertiesSet();
  gateway.start();
  ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class);
  gateway.handleMessage(new GenericMessage<>("foo"));
  verify(amqpTemplate).sendAndReceive(eq("foo"), eq("bar"), captor.capture());
  assertThat(captor.getValue().getMessageProperties().getDelay(), equalTo(42));
}
origin: spring-projects/spring-integration

@Override
protected Object handleRequestMessage(Message<?> requestMessage) {
  org.springframework.amqp.core.Message amqpMessage = MappingUtils.mapMessage(requestMessage,
      this.messageConverter, getHeaderMapper(), getDefaultDeliveryMode(), isHeadersMappedLast());
  addDelayProperty(requestMessage, amqpMessage);
  RabbitMessageFuture future = this.template.sendAndReceive(generateExchangeName(requestMessage),
      generateRoutingKey(requestMessage), amqpMessage);
  future.addCallback(new FutureCallback(requestMessage));
  CorrelationData correlationData = generateCorrelationData(requestMessage);
  if (correlationData != null && future.getConfirm() != null) {
    future.getConfirm().addCallback(new CorrelationCallback(correlationData, future));
  }
  return null;
}
org.springframework.amqp.rabbitAsyncRabbitTemplate$RabbitMessageFuture

Javadoc

A RabbitFuture with a return type of Message.

Most used methods

  • <init>
  • getConfirm
  • addCallback
  • getNackCause
  • set
  • setChannelHolder
  • setConfirm
  • startTimer

Popular in Java

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • IsNull (org.hamcrest.core)
    Is the value null?
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now