Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
.classpath
pom.xml.versionsBackup
*/dist/*
/Bundle/target/
/Bundle/target/
/Plugins-MQ/target/
38 changes: 38 additions & 0 deletions Plugins-MQ/docs/PluginMQHowTo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# OpenAS2 MQ Plugin

## Overview
This plugin allows OpenAS2 to interconnect with a Message Queue for message exchange
and message tracking events
## Installation
The plugin is enabled by adding the included Jars in the lib folder of your OpenAS2
installation and appending the module configuration section in the config.xml file
## Mode of Operation
The Module operates by creating 2 Outbound Topic publishing destinations and one
input consuming queue:

- Messages published into the input consuming queue will get wrapped into an AS2 message
and sent out to the corresponding partner based on the Partnership configuration file

- AS2 Messages received including MDNs will be published in the Messages Output
publishing Topic

- Any tracking events from the messages generated from either the AS2 Messages sent/received
will be posted as Event messages in the Event Output Publishing Topic

### Adapters
The module includes 2 adapters to connect with MQ Brokers:
- A generic JMS implementation of the MQ Broker connection
- A RabbitMQ implementation using the Java Native RabbitMQ client library

To use either, the corresponding Jar for the Driver library used on the adapter
must be also added to the server's Lib folder.

Authentication parameters and other details needed by the driver should be added
as attributes on the module declaration on config.xml

#### JMS Adapter
The JMS adapter uses the following parameters:
- jms_factory_jndi : The JNDI path of the Connection Factory used for JMS Connection
#### RMQ Adapter
- uri: AMQP Connection string to RabbitMQ, including Username/password, Host and Port
- virtualhost: Virtual host to attach
102 changes: 102 additions & 0 deletions Plugins-MQ/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.sf.openas2</groupId>
<artifactId>OpenAS2</artifactId>
<version>2.10.0</version>
</parent>
<artifactId>openas2-plugins-mq</artifactId>
<packaging>jar</packaging>

<name>OpenAS2 Plugins MQ</name>
<description>
MQ Plugin for OpenAS2
</description>

<properties>
<project.dist.package.name>${project.parent.artifactId}-plugin-mq-${project.version}.zip</project.dist.package.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lib.dir>${project.basedir}/lib</lib.dir>
<help.filename>PluginMQHowTo.md</help.filename>
<help.file.src>${project.basedir}/docs/${help.filename}</help.file.src>
<dist.dir>${project.basedir}/dist</dist.dir>
</properties>


<build>
<plugins>
<!--TODO it's not clear how the artifact is distributed-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<!--Copy artifact to build lib dicetory -->
<copy file="${project.build.directory}/${project.build.finalName}.jar"
todir="${project.build.directory}/dist/lib" verbose="true"/>
<!-- Add the help PDF version to the distro -->
<copy file="${help.file.src}" todir="${project.build.directory}/dist" verbose="true"/>
<!-- create distribution package -->
<zip destfile="${project.basedir}/dist/${project.dist.package.name}"
basedir="${project.build.directory}/dist"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.6.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.sf.openas2</groupId>
<artifactId>openas2-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
32 changes: 32 additions & 0 deletions Plugins-MQ/src/config/config_example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<openas2>

<!-- ... Import your settings from your original config.xml file -->
<processor classname="org.openas2.processor.DefaultProcessor"
pendingMDN="$properties.storageBaseDir$/pendingMDN3"
pendingMDNinfo="$properties.storageBaseDir$/pendinginfoMDN3">
<!-- ... Original Config.xml module entries ... -->
<!--
The position of the module declaration corresponds to the order
in which is going to be executed
-->

<!--
This module listens for DO_STORE, DO_STOREMDN & DO_TRACK_MSG events
it is recomended to defined it after the DbTrackingModule and MessageFileModule
to ensure the messages have been stored in the disk before publishing into MQ
-->
<module classname="com.greicodex.openas2.plugins.mq.MQConnector"
uri="amqp://username:password@rabbitmq.host:5672/"
virtualhost="/"
adapter="com.greicodex.openas2.plugins.mq.adapters.RMQAdapter"
parameters="123=123"
msg_topic="msgTopic"
msg_queue="msgQueue"
evt_topic="eventTopic"
errordir="$properties.storageBaseDir$/error/$date.YYYY$/$date.MM$"
>
</module>
<!-- ... Continue with Original config.xml .. -->
</processor>
</openas2>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.greicodex.openas2.plugins.mq;

import java.io.InputStream;
import java.util.Map;

/**
*
* @author javier
*/
public interface ConsumerCallback {
public void onMessage(Map<String,String> params,InputStream inputData);
}
Loading