Skip to content

Commit

Permalink
Pipeline2 (#36)
Browse files Browse the repository at this point in the history
* add islandora-connector-pipeline component

* update docs
  • Loading branch information
Natkeeran authored and dannylamb committed Mar 21, 2017
1 parent 4914dfb commit 558ef69
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 0 deletions.
17 changes: 17 additions & 0 deletions islandora-connector-pipeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Islandora Connector Pipeline

## Description

This service takes an incoming message and routes through the queues specified in the 'IslandoraPipelineRecipients' header as a comma separated list sequentially.

## Configuration

Once deployed, the incoming message stream can be configured by editing the `ca.islandora.alpaca.connector.pipeline.cfg` file in your Karaf installation's `etc` directory.

input.stream=broker:queue:islandora-connector-pipeline

For example, by changing `broker` to `activemq`, this service will attempt read messages from the ActiveMQ queue `islandora-connector-pipeline`. In theory, any broker technology supported by Camel should be supported, though ActiveMQ is the only one tested.

## More Information

For more information, please visit the [Apache Camel](http://camel.apache.org) documentation.
32 changes: 32 additions & 0 deletions islandora-connector-pipeline/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apply plugin: 'osgi'

description = 'Islandora CLAW Pipeline'

dependencies {
compile group: 'org.apache.camel', name: 'camel-core', version: camelVersion
compile group: 'org.apache.camel', name: 'camel-blueprint', version: camelVersion
compile group: 'org.apache.activemq', name: 'activemq-camel', version: activemqVersion
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
testCompile group: 'org.apache.camel', name: 'camel-test-blueprint', version: camelVersion
}

jar {
manifest {
description project.description
docURL project.docURL
vendor project.vendor
license project.license

instruction 'Import-Package', 'org.apache.activemq.camel.component,' +
"org.apache.camel;version=\"${camelVersionRange}\"," +
defaultOsgiImports
instruction 'Export-Package', 'ca.islandora.alpaca.connector.pipeline'
}
}

artifacts {
archives (file('build/cfg/main/ca.islandora.alpaca.connector.pipeline.cfg')) {
classifier 'configuration'
type 'cfg'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Incoming queue/topic on the broker of your choice.
# Replace the 'broker' prefix with the broker for your system.
# E.g. activemq, zeromq, etc...
input.stream=broker:queue:islandora-connector-pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to Islandora Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Islandora Foundation licenses this file to you under the MIT License.
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ca.islandora.alpaca.connector.pipeline;

import static org.apache.camel.LoggingLevel.INFO;

import org.apache.camel.ExchangePattern;
import org.apache.camel.builder.RouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A content router distributing messages to multiple endpoints.
*
* @author Daniel Lamb / Nat
*/
public class PipelineRouter extends RouteBuilder {

private static final Logger LOGGER = LoggerFactory.getLogger(PipelineRouter.class);

/**
* Configure the message route workflow.
*/
public void configure() throws Exception {
from("{{input.stream}}")
.routeId("Pipleline")
.description("Route incoming messages to queues based on header slip.")
.log(INFO, LOGGER,
"Distributing message: ${headers[JMSMessageID]} with timestamp ${headers[JMSTimestamp]}")
.routingSlip(header("IslandoraPipelineRecipients"))
.ignoreInvalidEndpoints();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

<cm:property-placeholder persistent-id="ca.islandora.alpaca.connector.pipeline" update-strategy="reload">
<cm:default-properties>
<cm:property name="input.stream" value="broker:queue:islandora-connector-pipeline" />
</cm:default-properties>
</cm:property-placeholder>

<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=fcrepo/Broker)"/>

<camelContext id="IslandoraConnectorPipeline" xmlns="http://camel.apache.org/schema/blueprint">
<package>ca.islandora.alpaca.connector.pipeline</package>
</camelContext>
</blueprint>
12 changes: 12 additions & 0 deletions karaf/src/main/resources/features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@
<configfile finalname="/etc/ca.islandora.alpaca.connector.broadcast.cfg">mvn:ca.islandora.alpaca/islandora-connector-broadcast/${project.version}/cfg/configuration</configfile>

</feature>

<feature name="islandora-connector-pipeline" version="${project.version}" start-level="80">
<details>Distributes a message to a list of queues/topics sequentially.</details>

<feature version="${fcrepoCamelToolboxVersion}">fcrepo-service-activemq</feature>

<bundle>mvn:ca.islandora.alpaca/islandora-connector-pipeline/${project.version}</bundle>

<configfile finalname="/etc/ca.islandora.alpaca.connector.pipeline.cfg">mvn:ca.islandora.alpaca/islandora-connector-pipeline/${project.version}/cfg/configuration</configfile>

</feature>

</features>
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
include ':islandora-karaf'
include ':islandora-indexing-triplestore'
include ':islandora-connector-broadcast'
include ':islandora-connector-pipeline'

project(':islandora-karaf').projectDir = "$rootDir/karaf" as File
project(':islandora-indexing-triplestore').projectDir = "$rootDir/islandora-indexing-triplestore" as File
project(':islandora-connector-broadcast').projectDir = "$rootDir/islandora-connector-broadcast" as File
project(':islandora-connector-pipeline').projectDir = "$rootDir/islandora-connector-pipeline" as File

0 comments on commit 558ef69

Please sign in to comment.