Skip to content

Commit

Permalink
Documentation update (#89)
Browse files Browse the repository at this point in the history
* Include (optional) broker class name into connection factory pool

* Bump version

* Update documentation

* Late addition
  • Loading branch information
dizzzz authored Oct 2, 2016
1 parent b8a2e21 commit 5cfd336
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 38 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions java/src/org/exist/jms/send/SenderConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion web/messaging-register.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<div class="col-md-9">
<h1>Messaging: Register JMS receiver</h1>
Expand All @@ -9,6 +8,7 @@ <h1>Messaging: Register JMS receiver</h1>
<strong>Warning!</strong> For this function the user must be 'dba' or he must be in the 'jms' group.
</div>
<section>
Consult the <a href="https://github.com/eXist-db/messaging-replication/wiki/Startup-Triggers#automatic-startup-xquerystartuptrigger">Startup Triggers</a> documentation to have the script executed when eXist-db is started.
<pre class="demo:display-source">(:
: Example: register receiver with additional parameters
:)
Expand Down
5 changes: 5 additions & 0 deletions web/replication-consumer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<h1>Replication: Consumer</h1>
<section>
<p>XML fragment for the "conf.xml" configuration file.</p>

<div class="alert alert-danger">
<strong>Please note !</strong> It is recommended to programatically register a replication receiver. See <a href="replication-register.html">the documentation</a>.
</div>

<pre class="demo:display-source" data-language="xml">&lt;!--
Start JMS listener for listener of the clustering feature.
--&gt;
Expand Down
65 changes: 34 additions & 31 deletions web/replication-functions.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<div class="col-md-9">
<h1>Replication: Register JMS receiver</h1>
<p>
XQuery code example to demonstrate how to register a replication listener.
</p>
<div class="alert alert-warning">
<strong>Warning!</strong> For this function the user must be 'dba' or he must be in the 'jms' group.
</div>
<div class="col-md-12">
<h1>Replication: XQuery functions</h1>
<p>For more details on the functions please consult the <a href="https://github.com/eXist-db/messaging-replication/wiki/Messaging">wiki</a>.</p>
<section>
<pre class="demo:display-source">(:
: 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)</pre>
<h2>Register receiver</h2>
Programatically register the replication receiver. Recommended to invoke during startup via the <a href="https://github.com/eXist-db/messaging-replication/wiki/Startup-Triggers#general-xquerystartuptrigger">XQuery Startup Trigger</a> mechanism. An example can be found <a href="replication-register.html">here</a>.
<div class="code" data-language="xquery">
(: Register replication receiver :)
replication:register($jmsConfiguration as map(*))
</div>
</section>
<section>
<h2>Sync resource</h2>
Synchronize a document or collection. The function requires a <b>collection.xconf</b> 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.
<div class="code" data-language="xquery">
(: Synchronize resource :)
replication:sync($path as xs:string)
</div>
</section>
<section>
<h2>Sync metadata of resource</h2>
Synchronize the metadata of a document or collection. The function requires a <b>collection.xconf</b> 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.
<div class="code" data-language="xquery">
(: Synchronize metadata of resource :)
replication:sync-metadata($path as xs:string)
</div>
</section>
<section>
<h2>Manage status ReplicationTrigger</h2>
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.
<div class="code" data-language="xquery">
(: Synchronize metadata of resource :)
replication:enable-trigger($newState as xs:boolean)
</div>
</section>

</div>
<div class="col-md-3"/>
</div>
38 changes: 38 additions & 0 deletions web/replication-register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<div class="col-md-9">
<h1>Replication: Register JMS receiver</h1>
<p>
XQuery code example to demonstrate how to register a replication listener.
</p>
<div class="alert alert-warning">
<strong>Warning!</strong> For this function the user must be 'dba' or he must be in the 'jms' group.
</div>
Consult the <a href="https://github.com/eXist-db/messaging-replication/wiki/Startup-Triggers#automatic-startup-xquerystartuptrigger">Startup Triggers</a> documentation to have the script executed when eXist-db is started.
<section>
<pre class="demo:display-source">(:
: 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)</pre>
</section>
</div>
<div class="col-md-3"/>
</div>
7 changes: 5 additions & 2 deletions web/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@
<a href="replication-functions.html">XQuery functions</a>
</li>
<li>
<a href="replication-producer.html">Producer</a>
<a href="replication-register.html">Register receiver</a>
</li>
<li>
<a href="replication-consumer.html">Consumer</a>
<a href="replication-producer.html">Producer configuration</a>
</li>
<li>
<a href="replication-consumer.html">Consumer configuration</a>
</li>
</ul>
</li>
Expand Down

0 comments on commit 5cfd336

Please sign in to comment.