Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

incodehq/ixn-subscriber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Caution
this project has been archived; the current version resides in a (private) gitlab repo.

Interaction Subscriber

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

Design

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.

Configuration

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

Local Testing

Prereqs : Message Broker

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

How to run the example

The configuration file above shows Camel configured to connect to a remote broker (tcp://localhost:61616).

To run, just use maven:

mvn -pl webapp spring-boot:run

Docker

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published