congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
GenericMessage.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.springframework.messaging.support.GenericMessage
constructor

Best Java code snippets using org.springframework.messaging.support.GenericMessage.<init> (Showing top 20 results out of 909)

origin: spring-projects/spring-framework

  @Override
  public void handleMessage(Message<?> message) throws MessagingException {
    MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel();
    replyChannel.send(new GenericMessage<>("response"));
  }
});
origin: spring-projects/spring-framework

@Test(expected = IllegalStateException.class)
public void sendMissingDestination() {
  Message<?> message = new GenericMessage<Object>("payload");
  this.template.send(message);
}
origin: spring-projects/spring-framework

@Test
public void sendAndReceive() {
  Message<?> requestMessage = new GenericMessage<Object>("request");
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  Message<?> actual = this.template.sendAndReceive("myChannel", requestMessage);
  assertEquals(requestMessage, this.template.message);
  assertSame(responseMessage, actual);
  assertSame(this.myChannel, this.template.messageChannel);
}
origin: spring-projects/spring-framework

@Test
public void sendAndReceiveToDestination() {
  Message<?> requestMessage = new GenericMessage<Object>("request");
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  Message<?> actual = this.template.sendAndReceive("somewhere", requestMessage);
  assertEquals("somewhere", this.template.destination);
  assertSame(requestMessage, this.template.requestMessage);
  assertSame(responseMessage, actual);
}
origin: spring-projects/spring-framework

@Test(expected = IllegalStateException.class)
public void sendNoDestinationResolver() {
  TestDestinationResolvingMessagingTemplate template = new TestDestinationResolvingMessagingTemplate();
  template.send("myChannel", new GenericMessage<Object>("payload"));
}
origin: spring-projects/spring-framework

@Test
public void convertAndSendToDestination() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("somewhere", "request", String.class);
  assertEquals("somewhere", this.template.destination);
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
}
origin: spring-projects/spring-framework

@Test
public void sendToDestination() {
  Message<?> message = new GenericMessage<Object>("payload");
  this.template.send("somewhere", message);
  assertEquals("somewhere", this.template.destination);
  assertSame(message, this.template.message);
}
origin: spring-projects/spring-framework

@Test
public void receive() {
  Message<?> expected = new GenericMessage<Object>("payload");
  this.template.setReceiveMessage(expected);
  Message<?> actual = this.template.receive("myChannel");
  assertSame(expected, actual);
  assertSame(this.myChannel, this.template.messageChannel);
}
origin: spring-projects/spring-framework

@Test
public void convertAndSendToDestinationWithHeaders() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("somewhere", "request", this.headers, String.class);
  assertEquals("somewhere", this.template.destination);
  assertEquals("value", this.template.requestMessage.getHeaders().get("key"));
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
}
origin: spring-projects/spring-framework

@Test
public void send() {
  Message<?> message = new GenericMessage<Object>("payload");
  this.template.send("myChannel", message);
  assertSame(this.myChannel, this.template.messageChannel);
  assertSame(message, this.template.message);
}
origin: spring-projects/spring-framework

@Test
public void convertSendAndReceiveWithPostProcessor() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  String actual = this.template.convertSendAndReceive("myChannel", "request", String.class, this.postProcessor);
  assertEquals("request", this.template.message.getPayload());
  assertSame("request", this.postProcessor.getMessage().getPayload());
  assertSame("response", actual);
  assertSame(this.myChannel, this.template.messageChannel);
}
origin: spring-projects/spring-framework

@Test
public void existingHeaders() throws InterruptedException {
  Map<String, Object> map = new HashMap<>();
  map.put("foo", "bar");
  map.put("bar", "baz");
  GenericMessage<String> message = new GenericMessage<>("payload", map);
  MessageHeaderAccessor accessor = new MessageHeaderAccessor(message);
  MessageHeaders actual = accessor.getMessageHeaders();
  assertEquals(3, actual.size());
  assertEquals("bar", actual.get("foo"));
  assertEquals("baz", actual.get("bar"));
}
origin: spring-projects/spring-framework

@Test
public void convertAndSend() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setDefaultDestination("home");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("request", String.class);
  assertEquals("home", this.template.destination);
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
}
origin: spring-projects/spring-framework

@Test
public void receiveAndConvert() {
  Message<?> expected = new GenericMessage<>("payload");
  this.template.setDefaultDestination("home");
  this.template.setReceiveMessage(expected);
  String payload = this.template.receiveAndConvert(String.class);
  assertEquals("home", this.template.destination);
  assertSame("payload", payload);
}
origin: spring-projects/spring-framework

@Test
public void setAttributesFromMessageWithMissingSessionId() {
  this.thrown.expect(IllegalStateException.class);
  this.thrown.expectMessage(startsWith("No session id in"));
  SimpAttributesContextHolder.setAttributesFromMessage(new GenericMessage<Object>(""));
}
origin: spring-projects/spring-framework

@Test
public void send() {
  Message<?> message = new GenericMessage<Object>("payload");
  this.template.setDefaultDestination("home");
  this.template.send(message);
  assertEquals("home", this.template.destination);
  assertSame(message, this.template.message);
}
origin: spring-projects/spring-framework

@Test
public void convertAndSendToDestinationWithPostProcessor() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("somewhere", "request", String.class, this.postProcessor);
  assertEquals("somewhere", this.template.destination);
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
  assertSame(this.postProcessor.getMessage(), this.template.requestMessage);
}
origin: spring-projects/spring-framework

@Test
public void convertAndSendToDestinationWithHeadersAndPostProcessor() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("somewhere", "request", this.headers,
      String.class, this.postProcessor);
  assertEquals("somewhere", this.template.destination);
  assertEquals("value", this.template.requestMessage.getHeaders().get("key"));
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
  assertSame(this.postProcessor.getMessage(), this.template.requestMessage);
}
origin: spring-projects/spring-framework

@Test
public void convertAndSendWithPostProcessor() {
  Message<?> responseMessage = new GenericMessage<Object>("response");
  this.template.setDefaultDestination("home");
  this.template.setReceiveMessage(responseMessage);
  String response = this.template.convertSendAndReceive("request", String.class, this.postProcessor);
  assertEquals("home", this.template.destination);
  assertSame("request", this.template.requestMessage.getPayload());
  assertSame("response", response);
  assertSame(this.postProcessor.getMessage(), this.template.requestMessage);
}
origin: spring-projects/spring-framework

@Test
public void receiveAndConvertFailed() {
  Message<?> expected = new GenericMessage<>("not a number test");
  this.template.setReceiveMessage(expected);
  this.template.setMessageConverter(new GenericMessageConverter());
  thrown.expect(MessageConversionException.class);
  thrown.expectCause(isA(ConversionFailedException.class));
  this.template.receiveAndConvert("somewhere", Integer.class);
}
org.springframework.messaging.supportGenericMessage<init>

Javadoc

Create a new message with the given payload.

Popular methods of GenericMessage

  • toString
  • getHeaders
  • getPayload

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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