Package com.amazonaws.services.sqs

Examples of com.amazonaws.services.sqs.AmazonSQSClient


    private final ObjectMapper objectMapper;

    private final Map<QSTaskModel, String> receiptHandles = new ConcurrentHashMap<QSTaskModel, String>();

    public AmazonSQSTaskService(String queueUrl) {
        this(queueUrl, new AmazonSQSClient());
    }
View Full Code Here


     
      if (CMBProperties.getInstance().useInlineApiCalls() && CMBProperties.getInstance().getCQSServiceEnabled()) {
        CQSAPI.sendMessage(user.getUserId(), Util.getRelativeForAbsoluteQueueUrl(absoluteQueueUrl), msg, null);
      } else {
            awsCredentials = new BasicAWSCredentials(user.getAccessKey(), user.getAccessSecret());
            sqs = new AmazonSQSClient(awsCredentials);
        sqs.setEndpoint(CMBProperties.getInstance().getCQSServiceUrl());
        sqs.sendMessage(new SendMessageRequest(absoluteQueueUrl, msg));     
      }
   
      if (CMBProperties.getInstance().getMaxMessagePayloadLogLength() > 0) {
View Full Code Here

    if ((message == null) || (endpoint == null)) {
      throw new Exception("Message and Endpoint must both be set");
    }
   
        awsCredentials = new BasicAWSCredentials(CMBProperties.getInstance().getAwsAccessKey(), CMBProperties.getInstance().getAwsAccessSecret());
        sqs = new AmazonSQSClient(awsCredentials);
   
    String url;
   
    if (com.comcast.cqs.util.Util.isValidQueueUrl(endpoint)) {
      url = endpoint;
View Full Code Here

    }

    if (queue == null) {
      if (sqsClient == null) {
        if (awsClientConfiguration == null) {
          sqsClient = new AmazonSQSClient(awsCredentialsProvider);
        } else {
          sqsClient = new AmazonSQSClient(awsCredentialsProvider,
              awsClientConfiguration);
        }
      }
      if (regionId != null) {
        sqsClient.setEndpoint(String.format("sqs.%s.amazonaws.com",
View Full Code Here

     * Provide the possibility to override this method for an mock implementation
     * @return AmazonSQSClient
     */
    AmazonSQSClient createClient() {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        AmazonSQSClient client = new AmazonSQSClient(credentials);
        if (configuration.getAmazonSQSEndpoint() != null) {
            client.setEndpoint(configuration.getAmazonSQSEndpoint());
        }
        return client;
    }
View Full Code Here

    private String topicArn;

    private static final Log log = LogFactory.getLog(JobStatusMonitor.class);

    public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) {
        sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration);
        sns = new AmazonSNSClient(credentialsProvider, clientConfiguration);
        setupQueueAndTopic();
    }
View Full Code Here

         * Important: Be sure to fill in your AWS access credentials in the
         *            AwsCredentials.properties file before you try to run this
         *            sample.
         * http://aws.amazon.com/security-credentials
         */
        AmazonSQS sqs = new AmazonSQSClient(new PropertiesCredentials(
                SimpleQueueServiceSample.class.getResourceAsStream("AwsCredentials.properties")));

        System.out.println("===========================================");
        System.out.println("Getting Started with Amazon SQS");
        System.out.println("===========================================\n");

        try {
            // Create a queue
            System.out.println("Creating a new SQS queue called MyQueue.\n");
            CreateQueueRequest createQueueRequest = new CreateQueueRequest("MyQueue");
            String myQueueUrl = sqs.createQueue(createQueueRequest).getQueueUrl();

            // List queues
            System.out.println("Listing all queues in your account.\n");
            for (String queueUrl : sqs.listQueues().getQueueUrls()) {
                System.out.println("  QueueUrl: " + queueUrl);
            }
            System.out.println();

            // Send a message
            System.out.println("Sending a message to MyQueue.\n");
            sqs.sendMessage(new SendMessageRequest(myQueueUrl, "This is my message text."));

            // Receive messages
            System.out.println("Receiving messages from MyQueue.\n");
            ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(myQueueUrl);
            List<Message> messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
            for (Message message : messages) {
                System.out.println("  Message");
                System.out.println("    MessageId:     " + message.getMessageId());
                System.out.println("    ReceiptHandle: " + message.getReceiptHandle());
                System.out.println("    MD5OfBody:     " + message.getMD5OfBody());
                System.out.println("    Body:          " + message.getBody());
                for (Entry<String, String> entry : message.getAttributes().entrySet()) {
                    System.out.println("  Attribute");
                    System.out.println("    Name:  " + entry.getKey());
                    System.out.println("    Value: " + entry.getValue());
                }
            }
            System.out.println();

            // Delete a message
            System.out.println("Deleting a message.\n");
            String messageRecieptHandle = messages.get(0).getReceiptHandle();
            sqs.deleteMessage(new DeleteMessageRequest(myQueueUrl, messageRecieptHandle));

            // Delete a queue
            System.out.println("Deleting the test queue.\n");
            sqs.deleteQueue(new DeleteQueueRequest(myQueueUrl));
        } catch (AmazonServiceException ase) {
            System.out.println("Caught an AmazonServiceException, which means your request made it " +
                    "to Amazon SQS, but was rejected with an error response for some reason.");
            System.out.println("Error Message:    " + ase.getMessage());
            System.out.println("HTTP Status Code: " + ase.getStatusCode());
View Full Code Here

    this.log = LogFactory.getLog(this.getClass());

    if (credentials != null) {
      this.credentials = new PropertiesCredentials(credentials);
      this.client = new AmazonGlacierClient(this.credentials);
      this.sqs = new AmazonSQSClient(this.credentials);
      this.sns = new AmazonSNSClient(this.credentials);
    }

    if (endpoint != null) {
      this.setEndpoint(endpoint);
View Full Code Here

TOP

Related Classes of com.amazonaws.services.sqs.AmazonSQSClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.