Category Archives: amazon-sqs

No such Method error while initializing SQS

I'm trying to initialize my queue with the following

  AWSCredentialService service = null;
    try {
  service = service.getInstance();
  String accessKey = service.getAccessKey();
  String secretKey = service.getSecretKey();
  String sessionToken = service.getSessionToken();
  ClientConfiguration clientConfiguraton = new ClientConfiguration();
  AWSCredentials awsCredentials = new BasicSessionCredentials(accessKey, secretKey, sessionToken);
  AmazonSQS testMDNqueue = new AmazonSQSClient(awsCredentials,clientConfiguraton);**
  Region usWest2 = Region.getRegion(Regions.US_EAST_1);
  System.out.println("Creating a fifo queue");
  CreateQueueRequest createQueueRequest = new CreateQueueRequest("MDNQueueTest.fifo");
  String myQueueUrl = testMDNqueue.createQueue(createQueueRequest).getQueueUrl();


I added some debug points and found out that the line where it initializes generates the following error

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V
    at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.<init>(
    at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.getPreferredSocketFactory(
    at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(
    at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(
    at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(
    at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(
    at com.amazonaws.http.AmazonHttpClient.<init>(
    at com.amazonaws.AmazonWebServiceClient.<init>(
    at com.amazonaws.AmazonWebServiceClient.<init>(

I tried to add the Correct HTTP CLIENT JAR based on resolution from other forums and am still not able to get this error resolved.

Any help is appreciated?

Storm with SQS and Cassandra insert happenning more than once

I have been recently trying out Apache Storm in AWS. I created an SQS spout which reads from SQS and passes to a Cassandra bolt to be inserted to db. When the db insert succeeds the acknowledgement is sent back and message is deleted from SQS. But when parallelism hint is increased a message is inserted more than once. Probably because another thread already read the same message from SQS before the acknowledgement reached back to spout. How can I handle this situation? Without parallelism the speed is quite slow.

How to reduce connection latency with AWS SQS?

When connecting to AWS SQS using AWS SDK, there seems to be a noticeable delay.

It is not so important when starting up a service to consume messages since after a 3-7 second delay on the first connection, the messages start flowing at a good speed -

BUT, when publishing messages it is a big problem. For example a user web request takes a few extra seconds to complete because of the connection to AWS is waiting to publish the message. This defeats the purpose of sending a message out in order to defer the wait time to a background job.

Is this a problem fixed with DNS? Networking? Or is it an AWS SQS setting? My web app is not in AWS network not sure if thats an issue.

Simple publishing a message code:

$aws = \Aws\Common\Aws::factory(/* array with connection settings */);
$client = $aws->get('Sqs');
$queue = $client->getQueueUrl(['QueueName' => $queue]);

// This takes 3 - 5 seconds every time its called.
$res = $this->client->sendMessage([
    'QueueUrl' => $queue['QueueUrl'],
    'MessageBody' => json_encode($request)