This service is now deprecated in favor of the Workflow Service v2 API. This service is no longer used in v4 of Boomerang Flow
- Table of Contents
- Description
- Dependencies
- Configuration
- Usage
- Testing
- Known Issues
- Contributing
- License
Boomerang Flow Listener is a Spring Boot microservice designed to consume events based on the CloudEvents specification and industry standard to describe events in a common way.
It also has domain specific endpoints to consume events from specific sources that may not meet this specification such as DockerHub and Slack webhooks.
Events that are consumed will be translated to a CloudEvent and submitted to the Workflow Service via HTTP or by publishing and consuming messages through NATS Jetstream, depending on what has been configured.
- Spring Boot Starter (
spring-boot-starter
) - Spring Boot Starter Web (
spring-boot-starter-web
) - Spring Boot Starter Log4j2 (
spring-boot-starter-log4j2
) - Spring Boot Starter Actuator (
spring-boot-starter-actuator
) - Spring Boot DevTools (
spring-boot-devtools
) - Boomerang Eventing Library (
lib-eventing
) - CloudEvents API (
cloudevents-api
) - Springfox Boot Starter (
springfox-boot-starter
) - Apache HttpClient (
httpclient
)
- Spring Boot Starter Test (
spring-boot-starter-test
) - JUnit Jupiter Engine (
junit-jupiter-engine
)
Boomerang Flow Listener integrates two types of event forwarding for both CloudEvents and Webhook notification events:
- Forward the event to NATS Jetstream.
- Forward the event directly to Workflow Service, which triggers a workflow if the payload is valid.
To configure the type of eventing, please see: Configuration Properties.
There are two main components that require to be configured to ensure an end-to-end working condition of the service, Workflow Service and NATS Jetstream related properties for Eventing Library:
-
Workflow Service properties:
workflow.service.host
- the host where Workflow Service is running.workflow.service.url.execute
- the URL to connect to for Workflow Service.workflow.service.url.validateToken
- the URL used for token validation.
-
Eventing-related properties1:
eventing.nats.server.urls
- a list of URL strings for connecting to one ore more NATS servers.eventing.jetstream.stream.name
- the name of the Jetstream stream to connect to. If the stream doesn't exists, it will be automatically created bylib-eventing
.eventing.jetstream.stream.subject
- the subject name for the stream. Visit https://docs.nats.io/jetstream/concepts/streams for more information on stream subject naming convention.eventing.jetstream.stream.storage-type
- the storage type of the Jetstream stream. This property is relevant only if the stream doesn't exist on the server and has to be created. Can be set only toFile
orMemory
.
eventing.enabled
- defines the type of event forwarding - the events are forwarded to NATS Jetstream if enabled, to Workflow Service otherwise. Defaults tofalse
.eventing.auth.enabled
- enables authorization for exposed eventing APIs. Defaults tofalse
eventing.nats.server.reconnect-wait-time
- the time to wait between reconnect attempts to the same server. Defaults toPT10S
, meaning 10 seconds.eventing.nats.server.reconnect-max-attempts
- the maximum number of reconnect attempts. Use0
to turn off auto-reconnect. Use-1
to turn on infinite reconnects. Defaults to-1
.
To run the application, see the instructions at: Spring Boot - Running Your Application.
The application also exposes additional endpoints (via Springfox Swagger Maven plugin) that provide information about all APIs, like request header, body, response type, response data, etc. These endpoints are:
- OpenAPI v2 Docs - http://localhost:7720/api-docs/
- OpenAPI v3 Docs - http://localhost:7720/v3/api-docs/
- Swagger API Documentation - http://localhost:7720/swagger-ui/
Replace <localhost:7720>
with the configured host and port on your computer.
NATS Jetstream Integration
If eventing is enabled in this service, it will attempt to connect to, and publish messages to NATS Jetstream. If you want to test the integration locally, create a server by running the following command (Docker required):
docker run --detach --network host -p 4222:4222 --name nats-jetstream nats -js
Visit https://docs.nats.io/jetstream/getting_started/using_docker for more information.
No known issues.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
All of our work is licenses under the Apache License Version 2.0 unless specified otherwise due to constraints by dependencies.
1. For more information on how to configure lib-eventing
, please visit: https://github.com/boomerang-io/lib.eventing/. ↩