View Javadoc

1   package com.atlassian.messagequeue.internal.core;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   /**
7    * A message intended to be nested inside the payload of a SQS message.
8    *
9    * This class represents a deliberate intent to avoid using SQS message attributes. One reason is that some
10   * external services can only produce SQS messages <em>without attributes</em> onto a SQS queue. For
11   * compatibility with those services, AMQ will too eschew attributes.
12   */
13  public class NestedMessage {
14      private Map<String, String> attributes = new HashMap<>();
15      private String payload;
16  
17      public String getAttribute(String name) {
18          return attributes.get(name);
19      }
20  
21      public NestedMessage addAttribute(String name, String value) {
22          attributes.put(name, value);
23          return this;
24      }
25  
26      public String getPayload() {
27          return payload;
28      }
29  
30      public NestedMessage setPayload(String payload) {
31          this.payload = payload;
32          return this;
33      }
34  }