116 lines
6.7 KiB
XML
116 lines
6.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<!-- ============================================================================= -->
|
||
<!-- Copyright © 2009 Red Hat, Inc. and others. -->
|
||
<!-- -->
|
||
<!-- The text of and illustrations in this document are licensed by Red Hat under -->
|
||
<!-- a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). -->
|
||
<!-- -->
|
||
<!-- An explanation of CC-BY-SA is available at -->
|
||
<!-- -->
|
||
<!-- http://creativecommons.org/licenses/by-sa/3.0/. -->
|
||
<!-- -->
|
||
<!-- In accordance with CC-BY-SA, if you distribute this document or an adaptation -->
|
||
<!-- of it, you must provide the URL for the original version. -->
|
||
<!-- -->
|
||
<!-- Red Hat, as the licensor of this document, waives the right to enforce, -->
|
||
<!-- and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent -->
|
||
<!-- permitted by applicable law. -->
|
||
<!-- ============================================================================= -->
|
||
|
||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||
<!ENTITY % BOOK_ENTITIES SYSTEM "HornetQ_User_Manual.ent">
|
||
%BOOK_ENTITIES;
|
||
]>
|
||
<chapter id="aerogear-integration">
|
||
<title>AeroGear Integration</title>
|
||
<para>AeroGears push technology provides support for different push notification technologies like Google Cloud Messaging,
|
||
Apple's APNs or Mozilla's SimplePush. HornetQ 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.</para>
|
||
<section>
|
||
<title>Configuring an AeroGear Connector Service</title>
|
||
<para>AeroGear Connector services are configured in the connector-services configuration:</para>
|
||
<programlisting>
|
||
<connector-service name="aerogear-connector">
|
||
<factory-class>org.apache.activemq.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>
|
||
</programlisting>
|
||
<para>Shown are the required params for the connector service and are:</para>
|
||
|
||
<itemizedlist>
|
||
<listitem>
|
||
<para><literal>endpoint</literal>. The endpoint or URL of you AeroGear application.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>queue</literal>. The name of the queue to consume from.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>application-id</literal>. The application id of your mobile application in AeroGear.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>master-secret</literal>. The secret of your mobile application in AeroGear.</para>
|
||
</listitem>
|
||
</itemizedlist>
|
||
<para>As well as these required paramaters there are the following optional parameters</para>
|
||
<itemizedlist>
|
||
<listitem>
|
||
<para><literal>ttl</literal>. The time to live for the message once AeroGear receives it.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>badge</literal>. The badge the mobile app should use for the notification.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>sound</literal>. The sound the mobile app should use for the notification.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>filter</literal>. A message filter(selector) to use on the connector.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>retry-interval</literal>. If an error occurs on send, how long before we try again to connect.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>retry-attempts</literal>. How many times we should try to reconnect after an error.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>variants</literal>. A comma separated list of variants that should get the message.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>aliases</literal>. A list of aliases that should get the message.</para>
|
||
</listitem>
|
||
<listitem>
|
||
<para><literal>device-types</literal>. A list of device types that should get the messag.</para>
|
||
</listitem>
|
||
</itemizedlist>
|
||
<para>More in depth explanations of the AeroGear related parameters can be found in the <ulink
|
||
url="http://aerogear.org/push/">AeroGear Push docs</ulink></para>
|
||
</section>
|
||
<section>
|
||
<title>How to send a message for AeroGear</title>
|
||
<para>To send a message intended for AeroGear simply send a JMS Message and set the appropriate headers, like so</para>
|
||
<programlisting>
|
||
Message message = session.createMessage();
|
||
|
||
message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from HornetQ");
|
||
|
||
producer.send(message);
|
||
</programlisting>
|
||
<para>The 'AEROGEAR_ALERT' property will be the alert sent to the mobile device.</para>
|
||
<note><para>If the message does not contain this property then it will be simply ignored and left on the queue</para></note>
|
||
<para>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:</para>
|
||
<programlisting>
|
||
message.setIntProperty("AEROGEAR_TTL", 1234);
|
||
</programlisting>
|
||
<para>or if you wanted to set the list of variants you would use:</para>
|
||
<programlisting>
|
||
message.setStringProperty("AEROGEAR_VARIANTS", "variant1,variant2,variant3");
|
||
</programlisting>
|
||
<para>Again refer to the AeroGear documentation for a more in depth view on how to use these settings</para>
|
||
</section>
|
||
</chapter> |