-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broadcaster 448 #22
Merged
Merged
Broadcaster 448 #22
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc8dd78
Commit before branch hopping
dannylamb 30be4b8
Pushing to fork so I can test on a vagrant box.
dannylamb 1d9876d
Merge branch 'master' of https://github.com/Islandora-CLAW/Alpaca int…
dannylamb 4aad4d0
Patching up features and adding junk routes to test manually.
dannylamb 7b2e069
Removed test routes. Pushed header containing list into configuration.
dannylamb 01d9e3c
Responding to @acoburn's feedback
dannylamb d110cbc
Adding README for the broadcaster.
dannylamb 83a4603
Removing header from configuration. I went a step too far.
dannylamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Islandora Connector Broadcast | ||
|
||
## Description | ||
|
||
This service takes an incoming message and broadcasts it to a list of queues/topics. The list of recipients is specified in the `IslandoraBroadcastRecipients` header as a comma separated list. | ||
|
||
## Configuration | ||
|
||
Once deployed, the incoming message stream can be configured by editing the `ca.islandora.alpaca.connector.broadcast.cfg` file in your Karaf installation's `etc` directory. | ||
|
||
input.stream=broker:queue:islandora-connector-broadcast | ||
|
||
For example, by changing `broker` to `activemq`, this service will attempt read messages from the ActiveMQ queue `islandora-connector-broadcast`. 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apply plugin: 'osgi' | ||
|
||
description = 'Islandora CLAW Broadcaster' | ||
|
||
dependencies { | ||
compile group: 'org.apache.camel', name: 'camel-core', version: camelVersion | ||
compile group: 'org.apache.camel', name: 'camel-blueprint', version: camelVersion | ||
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.camel;version=\"${camelVersionRange}\",${defaultOsgiImports}" | ||
instruction 'Export-Package', 'ca.islandora.alpaca.connector.broadcast' | ||
} | ||
} | ||
|
||
artifacts { | ||
archives (file('build/cfg/main/ca.islandora.alpaca.connector.broadcast.cfg')) { | ||
classifier 'configuration' | ||
type 'cfg' | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
islandora-connector-broadcast/src/main/cfg/ca.islandora.alpaca.connector.broadcast.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-broadcast |
50 changes: 50 additions & 0 deletions
50
...ctor-broadcast/src/main/java/ca/islandora/alpaca/connector/broadcast/BroadcastRouter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.broadcast; | ||
|
||
import static org.apache.camel.LoggingLevel.INFO; | ||
|
||
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 | ||
*/ | ||
public class BroadcastRouter extends RouteBuilder { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(BroadcastRouter.class); | ||
|
||
/** | ||
* Configure the message route workflow. | ||
*/ | ||
public void configure() throws Exception { | ||
|
||
// Distribute message based on configured header. | ||
from("{{input.stream}}") | ||
.routeId("MessageBroadcaster") | ||
.description("Broadcast messages from one queue/topic to other specified queues/topics.") | ||
.log(INFO, LOGGER, | ||
"Distributing message: ${headers[JMSMessageID]} with timestamp ${headers[JMSTimestamp]}") | ||
.recipientList(simple("${headers[IslandoraBroadcastRecipients]}")) | ||
.ignoreInvalidEndpoints(); | ||
} | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
islandora-connector-broadcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.broadcast" update-strategy="reload"> | ||
<cm:default-properties> | ||
<cm:property name="input.stream" value="broker:queue:islandora-connector-broadcast" /> | ||
</cm:default-properties> | ||
</cm:property-placeholder> | ||
|
||
<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=acrepo/Broker)"/> | ||
|
||
<camelContext id="IslandoraConnectorBroadcast" xmlns="http://camel.apache.org/schema/blueprint"> | ||
<package>ca.islandora.alpaca.connector.broadcast</package> | ||
</camelContext> | ||
</blueprint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
include ':islandora-karaf' | ||
include ':islandora-indexing-triplestore' | ||
include ':islandora-connector-broadcast' | ||
|
||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to leave this here, but I'd note that you're not actually using SLF4J in the code. (You may want to at some future point, but I'd probably remove this until that time comes).