2014-12-11 07:17:29 -05:00
|
|
|
# AeroGear Integration
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
AeroGears push technology provides support for different push
|
|
|
|
notification technologies like Google Cloud Messaging, Apple's APNs or
|
2015-04-27 17:32:30 -04:00
|
|
|
Mozilla's SimplePush. Apache ActiveMQ Artemis allows you to configure a Connector
|
2014-12-04 10:25:29 -05:00
|
|
|
Service that will consume messages from a queue and forward them to an
|
|
|
|
AeroGear push server and subsequently sent as notifications to mobile
|
|
|
|
devices.
|
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
## Configuring an AeroGear Connector Service
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
AeroGear Connector services are configured in the connector-services
|
|
|
|
configuration:
|
|
|
|
|
|
|
|
<connector-service name="aerogear-connector">
|
2015-04-27 17:32:30 -04:00
|
|
|
<factory-class>org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory</factory-class>
|
2014-12-04 10:25:29 -05:00
|
|
|
<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>
|
2015-02-25 08:37:19 -05:00
|
|
|
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
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](http://aerogear.org/push/)
|
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
## How to send a message for AeroGear
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
To send a message intended for AeroGear simply send a JMS Message and
|
|
|
|
set the appropriate headers, like so
|
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
``` java
|
|
|
|
Message message = session.createMessage();
|
2014-12-04 10:25:29 -05:00
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from ActiveMQ");
|
2014-12-04 10:25:29 -05:00
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
producer.send(message);
|
|
|
|
```
|
2015-02-25 08:37:19 -05:00
|
|
|
|
2014-12-04 10:25:29 -05:00
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
The 'AEROGEAR_ALERT' property will be the alert sent to the mobile
|
2014-12-04 10:25:29 -05:00
|
|
|
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:
|
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
``` java
|
|
|
|
message.setIntProperty("AEROGEAR_TTL", 1234);
|
|
|
|
```
|
2015-02-25 08:37:19 -05:00
|
|
|
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
or if you wanted to set the list of variants you would use:
|
|
|
|
|
2014-12-11 07:17:29 -05:00
|
|
|
``` java
|
|
|
|
message.setStringProperty("AEROGEAR_VARIANTS", "variant1,variant2,variant3");
|
2015-02-25 08:37:19 -05:00
|
|
|
```
|
|
|
|
```
|
2014-12-04 10:25:29 -05:00
|
|
|
|
|
|
|
Again refer to the AeroGear documentation for a more in depth view on
|
|
|
|
how to use these settings
|