AeroGear Integration | ActiveMQ Artemis Documentation

- Introduction
- 1. Legal Notice
- 2. Preface
- 3. Project Info
- 4. Messaging Concepts
- 5. Architecture
- 6. Using the Server
- 7. Using JMS
- 8. Using Core
- 9. Mapping JMS Concepts to the Core API
- 10. The Client Classpath
- 11. Examples
- 12. Routing Messages With Wild Cards
- 13. Understanding the Apache ActiveMQ Artemis Wildcard Syntax
- 14. Filter Expressions
- 15. Persistence
- 16. Configuring Transports
- 17. Detecting Dead Connections
- 18. Detecting Slow Consumers
- 19. Resource Manager Configuration
- 20. Flow Control
- 21. Guarantees of sends and commits
- 22. Message Redelivery and Undelivered Messages
- 23. Message Expiry
- 24. Large Messages
- 25. Paging
- 26. Queue Attributes
- 27. Scheduled Messages
- 28. Last-Value Queues
- 29. Message Grouping
- 30. Extra Acknowledge Modes
- 31. Management
- 32. Security
- 33. Resource Limits
- 34. The JMS Bridge
- 35. Client Reconnection and Session Reattachment
- 36. Diverting and Splitting Message Flows
- 37. Core Bridges
- 38. Duplicate Message Detection
- 39. Clusters
- 40. High Availability and Failover
- 41. Graceful Server Shutdown
- 42. Libaio Native Libraries
- 43. Thread management
- 44. Logging
- 45. REST Interface
- 46. Embedding Apache ActiveMQ Artemis
- 47. Spring Integration
- 48. AeroGear Integration
- 49. VertX Integration
- 50. Intercepting Operations
- 51. Protocols and Interoperability
- 52. Tools
- 53. Maven Plugin
- 54. Troubleshooting and Performance Tuning
- 55. Configuration Reference
- Published using GitBook

# ActiveMQ Artemis Documentation

# AeroGear Integration

AeroGears push technology provides support for different push notification technologies like Google Cloud Messaging, Apple's APNs or Mozilla's SimplePush. Apache ActiveMQ Artemis allows you to configure a Connector Service that will consume messages from a queue and forward them to an AeroGear push server and subsequently sent as notifications to mobile devices.

## Configuring an AeroGear Connector Service

AeroGear Connector services are configured in the connector-services configuration:

        <connector-service name="aerogear-connector">
        <factory-class>org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory</factory-class>
        <param key="endpoint" value="endpoint"/>
        <param key="queue" value="jms.queue.aerogearQueue"/>
        <param key="application-id" value="an applicationid"/>
        <param key="master-secret" value="a mastersecret"/>
        </connector-service>
        <address-setting match="jms.queue.lastValueQueue">
        <last-value-queue>true</last-value-queue>
        </address-setting>

Shown are the required params for the connector service and are:

- `endpoint`. The endpoint or URL of you AeroGear application.

- `queue`. The name of the queue to consume from.

- `application-id`. The application id of your mobile application in AeroGear.

- `master-secret`. The secret of your mobile application in AeroGear.

As well as these required paramaters there are the following optional parameters

- `ttl`. The time to live for the message once AeroGear receives it.

- `badge`. The badge the mobile app should use for the notification.

- `sound`. The sound the mobile app should use for the notification.

- `filter`. A message filter(selector) to use on the connector.

- `retry-interval`. If an error occurs on send, how long before we try again to connect.

- `retry-attempts`. How many times we should try to reconnect after an error.

- `variants`. A comma separated list of variants that should get the message.

- `aliases`. A list of aliases that should get the message.

- `device-types`. A list of device types that should get the messag.

More in depth explanations of the AeroGear related parameters can be found in the AeroGear Push docs

## How to send a message for AeroGear

To send a message intended for AeroGear simply send a JMS Message and set the appropriate headers, like so

    Message message = session.createMessage();

    message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from ActiveMQ");

    producer.send(message);

The 'AEROGEAR_ALERT' property will be the alert sent to the mobile device.

> Note

> If the message does not contain this property then it will be simply ignored and left on the queue

Its also possible to override any of the other AeroGear parameters by simply setting them on the message, for instance if you wanted to set ttl of a message you would:

    message.setIntProperty("AEROGEAR_TTL", 1234);

or if you wanted to set the list of variants you would use:

    message.setStringProperty("AEROGEAR_VARIANTS", "variant1,variant2,variant3");

```

Again refer to the AeroGear documentation for a more in depth view on how to use these settings