From 5cfd336b90d40e4cb5f189d55a684b8455a81e61 Mon Sep 17 00:00:00 2001 From: Dannes Wessels Date: Sun, 2 Oct 2016 11:34:38 +0200 Subject: [PATCH] Documentation update (#89) * Include (optional) broker class name into connection factory pool * Bump version * Update documentation * Late addition --- build.properties | 2 +- .../jms/send/SenderConnectionFactory.java | 8 ++- web/messaging-register.html | 2 +- web/replication-consumer.html | 5 ++ web/replication-functions.html | 65 ++++++++++--------- web/replication-register.html | 38 +++++++++++ web/templates/page.html | 7 +- 7 files changed, 89 insertions(+), 38 deletions(-) create mode 100644 web/replication-register.html diff --git a/build.properties b/build.properties index cd354b30..809e1c8b 100755 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ exist.dir=../exist/ # Extension details module.name=messaging-replication -module.version=0.9.11 +module.version=0.9.12 module.title=Messaging and Replication # Build instructions diff --git a/java/src/org/exist/jms/send/SenderConnectionFactory.java b/java/src/org/exist/jms/send/SenderConnectionFactory.java index f6f2ca95..a166d26d 100644 --- a/java/src/org/exist/jms/send/SenderConnectionFactory.java +++ b/java/src/org/exist/jms/send/SenderConnectionFactory.java @@ -48,8 +48,10 @@ class SenderConnectionFactory { */ static ConnectionFactory getConnectionFactoryInstance(final String brokerURL, String poolParam) { - // Get CF - ConnectionFactory retVal = connectionFactories.get(brokerURL); + final String storeID = brokerURL + "#" + poolParam; + + // Try to get CF + ConnectionFactory retVal = connectionFactories.get(storeID); // WHen not available create a new CF if (retVal == null) { @@ -71,7 +73,7 @@ static ConnectionFactory getConnectionFactoryInstance(final String brokerURL, St final ConnectionFactory cf = (ConnectionFactory) object; // Store newly created factory - connectionFactories.put(brokerURL, cf); + connectionFactories.put(storeID, cf); // Return to requester retVal = cf; diff --git a/web/messaging-register.html b/web/messaging-register.html index 230847d0..2499e622 100644 --- a/web/messaging-register.html +++ b/web/messaging-register.html @@ -1,4 +1,3 @@ -

Messaging: Register JMS receiver

@@ -9,6 +8,7 @@

Messaging: Register JMS receiver

Warning! For this function the user must be 'dba' or he must be in the 'jms' group.
+ Consult the Startup Triggers documentation to have the script executed when eXist-db is started.
(: 
  : Example: register receiver with additional parameters 
  :)
diff --git a/web/replication-consumer.html b/web/replication-consumer.html
index 77453b61..b4703220 100644
--- a/web/replication-consumer.html
+++ b/web/replication-consumer.html
@@ -4,6 +4,11 @@
         

Replication: Consumer

XML fragment for the "conf.xml" configuration file.

+ +
+ Please note ! It is recommended to programatically register a replication receiver. See the documentation. +
+
<!--
     Start JMS listener for listener of the clustering feature. 
 -->
diff --git a/web/replication-functions.html b/web/replication-functions.html
index 14d97d9d..30c7abad 100644
--- a/web/replication-functions.html
+++ b/web/replication-functions.html
@@ -1,37 +1,40 @@
 
 
-
-

Replication: Register JMS receiver

-

- XQuery code example to demonstrate how to register a replication listener. -

-
- Warning! For this function the user must be 'dba' or he must be in the 'jms' group. -
+
+

Replication: XQuery functions

+

For more details on the functions please consult the wiki.

-
(: 
- : Example: register replication receiver with configuration parameters 
- :)
-xquery version "3.0";
-
-
-import module namespace replication="http://exist-db.org/xquery/replication" 
-              at "java:org.exist.jms.xquery.ReplicationModule"; 
-
-
-let $jmsConfiguration := map {
-        "java.naming.factory.initial" 
-                := "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
-        "java.naming.provider.url" := "tcp://localhost:61616",
-        "connection-factory" := "ConnectionFactory",
-        "destination" := "dynamicTopics/eXistdb-replication-demo",
-        "subscriber.name" := "SubscriptionId",
-        "connection.client-id" := "ClientId"
-    }
-              
-return
-    replication:register($jmsConfiguration)
+

Register receiver

+ Programatically register the replication receiver. Recommended to invoke during startup via the XQuery Startup Trigger mechanism. An example can be found here. +
+(: Register replication receiver :) +replication:register($jmsConfiguration as map(*)) +
+
+

Sync resource

+ Synchronize a document or collection. The function requires a collection.xconf configuration document in /db/system/... for the collection that contains the resource. For a collection only that collection is synchronized, not the resources in the collection. +
+(: Synchronize resource :) +replication:sync($path as xs:string) +
+
+
+

Sync metadata of resource

+ Synchronize the metadata of a document or collection. The function requires a collection.xconf configuration document in /db/system/... for the collection that contains the resource. For a collection only that collection is synchronized, not the metadata of the resources in the collection. +
+(: Synchronize metadata of resource :) +replication:sync-metadata($path as xs:string) +
+
+
+

Manage status ReplicationTrigger

+ With this function the ReplicationTrigger can be (globally) switched on and off. This is usefull in case of restoring a backup or maintenance on the database. +
+(: Synchronize metadata of resource :) +replication:enable-trigger($newState as xs:boolean) +
+
+
-
\ No newline at end of file diff --git a/web/replication-register.html b/web/replication-register.html new file mode 100644 index 00000000..9a5daf02 --- /dev/null +++ b/web/replication-register.html @@ -0,0 +1,38 @@ + +
+
+

Replication: Register JMS receiver

+

+ XQuery code example to demonstrate how to register a replication listener. +

+
+ Warning! For this function the user must be 'dba' or he must be in the 'jms' group. +
+ Consult the Startup Triggers documentation to have the script executed when eXist-db is started. +
+
(: 
+ : Example: register replication receiver with configuration parameters 
+ :)
+xquery version "3.0";
+
+
+import module namespace replication="http://exist-db.org/xquery/replication" 
+              at "java:org.exist.jms.xquery.ReplicationModule"; 
+
+
+let $jmsConfiguration := map {
+        "java.naming.factory.initial" 
+                := "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
+        "java.naming.provider.url" := "tcp://localhost:61616",
+        "connection-factory" := "ConnectionFactory",
+        "destination" := "dynamicTopics/eXistdb-replication-demo",
+        "subscriber.name" := "SubscriptionId",
+        "connection.client-id" := "ClientId"
+    }
+              
+return
+    replication:register($jmsConfiguration)
+
+
+
+
\ No newline at end of file diff --git a/web/templates/page.html b/web/templates/page.html index 90f3dc7f..a2023653 100644 --- a/web/templates/page.html +++ b/web/templates/page.html @@ -77,10 +77,13 @@ XQuery functions
  • - Producer + Register receiver
  • - Consumer + Producer configuration +
  • +
  • + Consumer configuration