Caution
|
this project has been archived; the current version resides in a (private) gitlab repo. |
This microservice is responsible for subscribing to an ActiveMQ message broker and forwarding on any interaction messages (originally originating from an Apache Isis) application onto a REST endpoint.
It can be used in conjunction with the incodehq/ixn-relay to publish messages from an Apache Isis application to an integration webapp (eg implemented using Apache Camel), but without either the Apache Isis app nor the integration app having knowledge of the other.
[ixn-relay] as ir [Apache Isis\nApp] as app [Integration\nApp] as ia [ActiveMQ] as mb [ixn-subscriber] as is app <-d. ir is -.r-> ia mb .d-> is ir -.r-> mb
The diagram below sketches the design:
hide empty members component ActiveMQ { } component "ixn-subscriber" { package relay { interface RelayRest { handle() } } package relay-rest { class RelayRest implements Relay { } } package webapp { class SubscribingRoute { } class Dispatcher { } } } component RestEndpoint { } ActiveMQ .r-> SubscribingRoute SubscribingRoute .d-> Dispatcher Dispatcher -> "0..*" Relay RelayRest .r-> RestEndpoint : http POST
The SubscribingRoute
is responsible for subscribing to an ActiveMQ (JMS) queue.
It simply forwards onto the Dispatcher
.
The Dispatcher
in turn loops over all available Relay
implementations
Finally, the RelayRest
implementation posts the interaction to the specified REST endpoint.
This microservice has been implemented using Spring Boot, and so is configured using an application.yaml
file:
logging:
config: classpath:logback.xml
camel:
springboot:
main-run-controller: true
spring:
activemq:
broker-url: tcp://localhost:61616
app:
queue-name: memberInteractionsQueue
relay-cxfrs:
base: http://localhost:9090/est2coda/
uri-suffix: memberInteractionsQueue
relay-rest:
base: http://localhost:9090/est2coda/
uri-suffix: memberInteractionsQueue
username: alex
password: pass
connection-timeout: 60s
receive-timeout: 60s
tracing:
tracing-type: none
This image requires an instance of Apache ActiveMQ to be running. The easiest way to do this is using the incodehq/activemq-mssqlserver Docker image. Note, this will default to using an in-memory database, so it has no hard pre-reqs itself.
For example:
export TAG=20191011.1912.master.880118bc
docker run -d -p61616:61616 -p8161:8161 incodehq/activemq-mssqlserver:$TAG
Then, log on using: http://localhost:8161
A Docker image of this app is available at Docker hub.
To allow configuration to be easily externalized, the image expects a /run/secrets
directory to exist, and switches to and then runs the application in that directory.
Spring Boot will then automatically pick up that configuration and use it.
Typically therefore all that is required is to define an application.yaml
or application.properties
file as a secret.
If the secret filename has a prefix, as may be the case for Docker swarm namespacing, (eg foo.bar.application.yaml
) then a symbolic link (eg application.yaml
) will be automatically created to the secret filename.