Search in sources :

Example 1 with AmazonSQSMessagingClientWrapper

use of com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper in project kylo by Teradata.

the class SqsService method getQueue.

@Override
public Queue getQueue(String queueName) {
    String name = destinationResolver.resolveName(queueName);
    try {
        // Create a new Queue if required
        SQSConnection connection = connectionFactory.createConnection();
        AmazonSQSMessagingClientWrapper client = connection.getWrappedAmazonSQSClient();
        if (!client.queueExists(name)) {
            client.createQueue(name);
        }
        // Queue must already exist
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        return session.createQueue(name);
    } catch (JMSException e) {
        throw new IllegalStateException(e);
    }
}
Also used : AmazonSQSMessagingClientWrapper(com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper) JMSException(javax.jms.JMSException) SQSConnection(com.amazon.sqs.javamessaging.SQSConnection) Session(javax.jms.Session)

Example 2 with AmazonSQSMessagingClientWrapper

use of com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper in project goobi-workflow by intranda.

the class ExternalConnectionFactory method createQueues.

private static void createQueues(SQSConnection connection) throws JMSException {
    ConfigurationHelper config = ConfigurationHelper.getInstance();
    AmazonSQSMessagingClientWrapper sqsClient = connection.getWrappedAmazonSQSClient();
    // we need to explicitly create the queues in SQS
    if (!sqsClient.queueExists(config.getQueueName(QueueType.COMMAND_QUEUE))) {
        createFifoQueue(sqsClient, config.getQueueName(QueueType.COMMAND_QUEUE));
    }
    if (!sqsClient.queueExists(config.getQueueName(QueueType.EXTERNAL_QUEUE))) {
        createFifoQueue(sqsClient, config.getQueueName(QueueType.EXTERNAL_QUEUE));
    }
}
Also used : AmazonSQSMessagingClientWrapper(com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper) ConfigurationHelper(de.sub.goobi.config.ConfigurationHelper)

Aggregations

AmazonSQSMessagingClientWrapper (com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper)2 SQSConnection (com.amazon.sqs.javamessaging.SQSConnection)1 ConfigurationHelper (de.sub.goobi.config.ConfigurationHelper)1 JMSException (javax.jms.JMSException)1 Session (javax.jms.Session)1