A concourse resource for subscribing and publishing into a message-queue.
uri
: Required. The location of the message-queuequeue
: Required. The type of queue plugin to use. Supported plugins arensq
andnats
.sub
: Optional. The subscribing topicpub
: Optional. The publishing topicparams
: Optional. A generic String Key/Value map used differently by each plugin
This is a plugin for nsq.io. nsq
guarantees at-least-once delivery, so subscribing in a resource is possible. Dockerfile.test.nsq
has an example configuration under SOURCE
env variable.
channel
: Optional. Subscribing to a specific channel under the previously definedsub
topic. (Defaults to a random string)
This is a plugin for nats.io. nats
does not guarantee at-least-once delivery, so subscribing is not possible. This plugin can only be used when using a put
. Dockerfile.test.nats
has an example configuration under SOURCE
env variable.
resources:
- name: queue-name
type: mq
source:
queue: nats
uri: nats://0.0.0.0:4222
pub: caring_listeners
Receiving subscriptions to message.json
- get: queue-name
params: { file: "message.json" }
Publishing out the message:
- get: a-resource
- put: queue-name
params: { file: "output.json" }
Modify bosh deployment manifest by adding the following to groundcrew.additional_resource_types
:
- image: docker:///aminjam/mq-resource
type: mq
The message queue is scanned for any json
encoded message for the subscribing topic. If the returned object is the same as the current version, no result is returned.
Write the requested json
string Key/Value into a file
file
: Optional. The path and name of the file to be written (Defaults tomessage.json
)
Publish the content of the file to the queue.
file
: Optional. The path and name of the file to be written (Defaults tomessage.json
)
Built with Go 1.5.2 and GO15VENDOREXPERIMENT
flag.
git clone https://github.com/aminjam/mq-resource && cd mq-resource
make init
make build
make test #Optional PLUGIN="nsq"
This is my first attempt in making a concourse-resource. Since this a message queue, there is no guarantee of receiving the same version/message, unlike git-resource
. This is considered an experimental resource.