aws-sqs-ra

Amazon SQS JMS Resource Adapter

License

License

Categories

Categories

AWS Container PaaS Providers
GroupId

GroupId

io.bpic.aws
ArtifactId

ArtifactId

aws-sqs-ra
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

pom
Description

Description

aws-sqs-ra
Amazon SQS JMS Resource Adapter
Project URL

Project URL

https://github.com/bpicio/aws-sqs-ra
Source Code Management

Source Code Management

http://github.com/bpicio/aws-sqs-ra/tree/master

Download aws-sqs-ra

Filename Size
aws-sqs-ra-1.0.3.pom 9 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/io.bpic.aws/aws-sqs-ra/ -->
<dependency>
    <groupId>io.bpic.aws</groupId>
    <artifactId>aws-sqs-ra</artifactId>
    <version>1.0.3</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.bpic.aws/aws-sqs-ra/
implementation 'io.bpic.aws:aws-sqs-ra:1.0.3'
// https://jarcasting.com/artifacts/io.bpic.aws/aws-sqs-ra/
implementation ("io.bpic.aws:aws-sqs-ra:1.0.3")
'io.bpic.aws:aws-sqs-ra:pom:1.0.3'
<dependency org="io.bpic.aws" name="aws-sqs-ra" rev="1.0.3">
  <artifact name="aws-sqs-ra" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.bpic.aws', module='aws-sqs-ra', version='1.0.3')
)
libraryDependencies += "io.bpic.aws" % "aws-sqs-ra" % "1.0.3"
[io.bpic.aws/aws-sqs-ra "1.0.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • aws-sqs-rar
  • aws-sqs-jca-api

Amazon SQS JMS Resource Adapter

Maven Central

Getting Started

Installation

For Wildfly, copy aws-sqs-rar-[VERSION HERE].rar to your application server deployment folder. In standalone it should be:

$WILDFLY_HOME/standalone/deployments

Either reference the resource adapter on your MDB using:

@ResourceAdapter("aws-sqs-rar-[VERSION HERE].rar")

Or by setting as the default adapter on standalone-full.xml:

<subsystem xmlns="urn:jboss:domain:ejb3:6.0">
    ...
    <mdb>
        <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
        ...
    </mdb>
    ...
</subsystem>

Then create a queue:

<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
    <resource-adapters>
        <resource-adapter id="aws-sqs-rar-[VERSION HERE].rar">
            <archive>
                aws-sqs-rar-${project.version}.rar
            </archive>
            <transaction-support>NoTransaction</transaction-support>
            <admin-objects>
                <admin-object class-name="io.bpic.aws.sqs.ra.SQSJMSQueue" jndi-name="java:jboss/sqs/queue/QueueName" pool-name="QueuePool">
                    <config-property name="queueName">[QUEUE NAME]</config-property>
                </admin-object>
            </admin-objects>
        </resource-adapter>
    </resource-adapters>
</subsystem>

Inbound MDB

To receive messages you must implement the MessageListener interface.

public class ReceiveSQSMDB implements MessageListener {
   
} 

Also you must set the ActivationConfigProperty values suitable for your MDB.

Valid properties are below.

Config Property Name Type Default Notes
awsAccessKeyId String None Must be set to the access key of your AWS account (Optional)
awsSecretKey String None Must be set to the secret key of your AWS account (Optional)
destination String None JNDI queue name
region String None Must be set to the AWS region name of your queue. (Optional)

Your MDB should contain one method annotated with @OnMessage

A full skeleton MDB is shown below

@MessageDriven(activationConfig = {
    @ActivationConfigProperty(propertyName = "awsAccessKeyId", propertyValue = "${ENV=accessKey}"),
    @ActivationConfigProperty(propertyName = "awsSecretKey", propertyValue = "${ENV=secretKey}"),
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "${ENV=destination}"),   
    @ActivationConfigProperty(propertyName = "region", propertyValue = "eu-west-2")    
})
@ResourceAdapter("aws-sqs-rar-[VERSION HERE].rar")
public class ReceiveSQSMDB implements MessageListener {

    @OnMessage
    public void receiveMessage(Message message) {
        System.out.println("Got message " + message.getBody());
    }
}

License

This project is licensed under the GNU AGPLv3 License - see the LICENSE.md file for details

io.bpic.aws

BP Internet

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0