/** * <p> * The URL of the Amazon SQS queue to which a message is sent. * </p> * <p> * Queue URLs and names are case-sensitive. * </p> * * @param queueUrl * The URL of the Amazon SQS queue to which a message is sent.</p> * <p> * Queue URLs and names are case-sensitive. * @return Returns a reference to this object so that method calls can be chained together. */ public SendMessageRequest withQueueUrl(String queueUrl) { setQueueUrl(queueUrl); return this; }
/** * Constructs a new SendMessageRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param queueUrl * The URL of the Amazon SQS queue to which a message is sent.</p> * <p> * Queue URLs and names are case-sensitive. * @param messageBody * The message to send. The maximum string size is 256 KB. * </p> * <important> * <p> * A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed: * </p> * <p> * <code>#x9</code> | <code>#xA</code> | <code>#xD</code> | <code>#x20</code> to <code>#xD7FF</code> | * <code>#xE000</code> to <code>#xFFFD</code> | <code>#x10000</code> to <code>#x10FFFF</code> * </p> * <p> * Any characters not included in this list will be rejected. For more information, see the <a * href="http://www.w3.org/TR/REC-xml/#charsets">W3C specification for characters</a>. * </p> */ public SendMessageRequest(String queueUrl, String messageBody) { setQueueUrl(queueUrl); setMessageBody(messageBody); }
public void store (TaskStatistics ts) { try { String json = objectMapper.writeValueAsString(ts); SendMessageRequest req = new SendMessageRequest(); req.setMessageBody(json); req.setQueueUrl(queueUrl); sqs.sendMessageAsync(req, new AsyncHandler<SendMessageRequest, SendMessageResult>() { @Override public void onError(Exception e) { LOG.error("Error saving stats to SQS", e); } @Override public void onSuccess(SendMessageRequest request, SendMessageResult sendMessageResult) { /* do nothing */ } }); } catch (Exception e) { LOG.error("Error saving stats to SQS", e); } } }
/** * Constructs a new SendMessageRequest object. Callers should use the setter * or fluent setter (with...) methods to initialize any additional object * members. * * @param queueUrl <p> * The URL of the Amazon SQS queue to take action on. * </p> * <p> * Queue URLs are case-sensitive. * </p> * @param messageBody <p> * The message to send. String maximum 256 KB in size. For a list * of allowed characters, see the preceding note. * </p> */ public SendMessageRequest(String queueUrl, String messageBody) { setQueueUrl(queueUrl); setMessageBody(messageBody); }
throws AmazonServiceException, AmazonClientException { SendMessageRequest sendMessageRequest = new SendMessageRequest(); sendMessageRequest.setQueueUrl(queueUrl); sendMessageRequest.setMessageBody(messageBody); return sendMessage(sendMessageRequest);
/** * <p> * The URL of the Amazon SQS queue to which a message is sent. * </p> * <p> * Queue URLs and names are case-sensitive. * </p> * * @param queueUrl * The URL of the Amazon SQS queue to which a message is sent.</p> * <p> * Queue URLs and names are case-sensitive. * @return Returns a reference to this object so that method calls can be chained together. */ public SendMessageRequest withQueueUrl(String queueUrl) { setQueueUrl(queueUrl); return this; }
/** * Constructs a new SendMessageRequest object. Callers should use the setter * or fluent setter (with...) methods to initialize any additional object * members. * * @param queueUrl <p> * The URL of the Amazon SQS queue to take action on. * </p> * <p> * Queue URLs are case-sensitive. * </p> * @param messageBody <p> * The message to send. String maximum 256 KB in size. For a list * of allowed characters, see the preceding note. * </p> */ public SendMessageRequest(String queueUrl, String messageBody) { setQueueUrl(queueUrl); setMessageBody(messageBody); }
/** * Constructs a new SendMessageRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param queueUrl * The URL of the Amazon SQS queue to which a message is sent.</p> * <p> * Queue URLs and names are case-sensitive. * @param messageBody * The message to send. The maximum string size is 256 KB. * </p> * <important> * <p> * A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed: * </p> * <p> * <code>#x9</code> | <code>#xA</code> | <code>#xD</code> | <code>#x20</code> to <code>#xD7FF</code> | * <code>#xE000</code> to <code>#xFFFD</code> | <code>#x10000</code> to <code>#x10FFFF</code> * </p> * <p> * Any characters not included in this list will be rejected. For more information, see the <a * href="http://www.w3.org/TR/REC-xml/#charsets">W3C specification for characters</a>. * </p> */ public SendMessageRequest(String queueUrl, String messageBody) { setQueueUrl(queueUrl); setMessageBody(messageBody); }
@Override public void push(String task) { if (!StringUtils.isBlank(url) && task != null) { // only allow strings - ie JSON if (!StringUtils.isBlank(task)) { // Send a message try { SendMessageRequest sendReq = new SendMessageRequest(); sendReq.setQueueUrl(url); sendReq.setMessageBody(task); client().sendMessage(sendReq); } catch (AmazonServiceException ase) { logException(ase); } catch (AmazonClientException ace) { logger.error("Could not reach SQS. {}", ace.toString()); } } } }
/** * Send an event message to SQS. * * @param event * @throws SiteWhereException */ protected void sendSqsMessage(IDeviceEvent event) throws SiteWhereException { SendMessageRequest message = new SendMessageRequest(); message.setMessageBody(MarshalUtils.marshalJsonAsString(event)); message.setQueueUrl(getQueueUrl()); SendMessageResult result = getSqs().sendMessage(message); LOGGER.debug("Sent SQS message with id: " + result.getMessageId()); }
throws AmazonServiceException, AmazonClientException { SendMessageRequest sendMessageRequest = new SendMessageRequest(); sendMessageRequest.setQueueUrl(queueUrl); sendMessageRequest.setMessageBody(messageBody); return sendMessage(sendMessageRequest);
/** * Send an event message to SQS. * * @param event * @throws SiteWhereException */ protected void sendSqsMessage(IDeviceEvent event) throws SiteWhereException { SendMessageRequest message = new SendMessageRequest(); message.setMessageBody(MarshalUtils.marshalJsonAsString(event)); message.setQueueUrl(getQueueUrl()); SendMessageResult result = getSqs().sendMessage(message); getLogger().debug("Sent SQS message with id: " + result.getMessageId()); }