[ 
https://issues.apache.org/jira/browse/CAMEL-3869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403490#comment-13403490
 ] 

Luc Pezet commented on CAMEL-3869:
----------------------------------

Right, it's in the configuration class...but if it's not used, what good does 
it do? ;)
{quote}
 CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
 ...
 CreateQueueResult queueResult = client.createQueue(request);
 queueUrl = queueResult.getQueueUrl();
{quote}
will give an error if the visibility timeout of the queue 
"configuration.getQueueName()" is different from the default one.
A (wrong I believe) fix would be:
{quote}
 CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
 
request.setDefaultVisibilityTimeout(configuration.getDefaultVisibilityTimeout());
 ...
 CreateQueueResult queueResult = client.createQueue(request);
 queueUrl = queueResult.getQueueUrl();
{quote}
Now, after the creation of the queue, it seems the logic is to try to apply the 
defaultVisibilityTimeout to the created/existing queue:
{quote}
 if (getConfiguration().getDefaultVisibilityTimeout() != null) {
    updateAttribute("VisibilityTimeout", 
getConfiguration().getDefaultVisibilityTimeout());
 }
{quote}

So if the idea is to be able to set the default visibility timeout to a queue 
(newly created or existing), then a ListQueues is necessary I think.

Here's what I would suggest:
{quote}
  ListQueuesRequest request = new ListQueuesRequest
  r.setQueueNamePrefix(configuration.getQueueName());
  ListQueuesResponse response = client.listQueues(request);
  queueUrl = response.getQueueUrls().get(0); // NB: may want to check a little 
more here
  ...
{quote}

The rest of the code would remain the same.

What do you think?
                
> Patch for Camel AWS SQS endpoint to set maximum message size and message 
> retention period.
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3869
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3869
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-aws
>    Affects Versions: 2.7.1
>            Reporter: Sean Parsons
>            Assignee: Christian Müller
>            Priority: Minor
>             Fix For: 2.8.0
>
>         Attachments: sqsattributes.patch
>
>
> We wished to have the ability to control the MaximumMessageSize and 
> MessageRetentionPeriod through Camel, as otherwise it requires some external 
> process to update those values after the queues have been created.  
> Documentation of these options is here: 
> http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QuerySetQueueAttributes.html
> So far this only sets those settings, but it should be easy to update it with 
> the others that are supported by SetQueueAttributes. I made some moderate 
> tweaks along the way but nothing groundbreaking, the only thing I'm not sure 
> about is my adding of those attribute names to SqsConstants.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to