activemq-artemis/docs/user-manual/en/aerogear-integration.xml

116 lines
6.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 AttributionShare 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>
&lt;connector-service name="aerogear-connector">
&lt;factory-class>org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory&lt;/factory-class>
&lt;param key="endpoint" value="endpoint"/>
&lt;param key="queue" value="jms.queue.aerogearQueue"/>
&lt;param key="application-id" value="an applicationid"/>
&lt;param key="master-secret" value="a mastersecret"/>
&lt;/connector-service>
&lt;address-setting match="jms.queue.lastValueQueue">
&lt;last-value-queue>true&lt;/last-value-queue>
&lt;/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>