Comments (5)
So I've got something very similar right now, all declarations are optional, you can declare a queue + N bindings on the input, and an exchange on the output. I haven't got fields for passive
declarations, but I can add those if anyone requests it. Similarly I haven't got args
support but I can add it in if someone requests it.
from connect.
Work is currently on https://github.com/Jeffail/benthos/tree/feature/amqp-declarations, I'll merge later today if I'm still happy with it.
from connect.
Didn't look at the changes yet, but since you asked for my thoughts, here we go.
AMQP input
Minimal configuration
Inputs are consumers, and consumers consume from queues exclusively, not exchanges.
Therefore, by default I would expect to be required to configure just a queue name, and be ready to start consuming. There is no reason to automatically create any exchanges or bindings, that's more relevant to the output type. I would expect to be able configure a few things related to the consumer, like the consumer tag (I would expect by default this to be set to something like benthos-[n]
), the exclusive
flag and qos (prefetch) config. In this scenario, we expect that some application is responsible for preparing the queue Benthos can consume from.
This should be enough, and should not attempt to make any structural modifications to the broker (keep in mind that the user might not even have permissions to declare queues or exchanges).
type: amqp
amqp:
queue: benthos-queue
url: amqp://guest:guest@localhost:5672/
Declaring the queue
As an extra option, Benthos could declare the queue for us. This would result in any producer application to just wait until the queue exists. Alternatively, Benthos could passively declare the queue, which acts more of an assertion that the queue exists and has specific settings. This would introduce some more settings like this:
type: amqp
amqp:
queue: benthos-queue
queue_declare: true
queue_declare_passive: true
queue_durable: true
queue_exclusive: false
url: amqp://guest:guest@localhost:5672/
Or maybe more structured, like this:
type: amqp
amqp:
queue:
name: benthos-queue
declare:
passive: true
durable: true
exclusive: false
url: amqp://guest:guest@localhost:5672/
Binding the queue to an exchange
Another separate feature would be creating the binding between the queue and an existing exchange (or the exchange that Benthos is configured to create, see below). The use case here would be that there already exists an (probably fan-out or topic) exchange that emits messages that Benthos is interested in and wants to tap into. This is where creating the binding with a specific routing key and properties comes in. Depending on the type of exchange, it would also be nice to be able to configure the binding arguments. For example for a headers exchange, this can be used to specify some filters. It would also be nice to be able to create multiple bindings while we're at it.
type: amqp
amqp:
queue:
name: benthos-queue
declare: true
bindings:
- exchange: fruity-events
routing_key: ''
args:
x-match: all
color: orange
shape: round
- exchange: fruity-events
routing_key: ''
args:
x-match: all
color: yellow
shape: curved
url: amqp://guest:guest@localhost:5672/
Declaring an exchange
Although I can't actually really think of a use case where we would need to declare a dedicated exchange for a Benthos input, this should be definitely be a separate option as well if you want to support it. I think, if there is a central object dedicated to publishing to Benthos, it might as well be a plain queue.
AMQP output
Minimal configuration
In AMQP land, you always publish to an exchange. You might think you're publishing directly to a queue, but in fact you're publishing to the default exchange, which routes the message to the queue specified in the routing key. This should be the default minimal configuration, so again, no creating exchanges, queues or bindings by default. This should be enough.
type: amqp
amqp:
exchange: '' # Empty string resolves to the default exchange
routing_key: benthos-messages # This is the queue name we directly publish to
url: amqp://guest:guest@localhost:5672/
Also declaring the exchange
Okay, this is the only scenario where declaring an exchange actually makes sense in my opinion. It's a good approach to let Benthos declare it's own exchange (or passively check that it exists with the correct settings), and not worry about which queues should be bound to it. Binding to the Benthos exchange should be the responsibility of whichever application is interested in actually receiving the messages.
type: amqp
amqp:
exchange:
name: benthos
declare:
passive: false
durable: true
type: fanout
args: {} # For some exchange types it would be nice to be able to specify the arguments field
routing_key: ''
url: amqp://guest:guest@localhost:5672/
Okay I think that's about it. Good luck :p
from connect.
Awesome, thanks @EdeMeijer. The new set up looks similar to what I have mocked except I'm missing the list of bindings, which is nice.
from connect.
Great job. I think I don't need either passive or args right now, so that's fine.
from connect.
Related Issues (20)
- 4.28.0 should really be 5.0.0 HOT 3
- Document change in licensing HOT 2
- Inconsistent behavior with Javascript processing HOT 1
- JavaScript processor unable to handle asynchronous code execution HOT 1
- Iceberg support HOT 1
- Esto serΓ‘ facil
- MwM
- Exclude enterprise licensed plugins from the all package HOT 2
- main.go seems to be Redpanda Enterprise licensed HOT 2
- Document workflow/result_map
- CLI references the wrong binary name
- Collaborate on a Benthos processor for a Conduit pipeline?
- Dependency Licensing issue caused by couchbase/gocbcoreps HOT 3
- aws_kinesis input: shards are not processed if they are closed HOT 4
- public free bundle missing the xml package import HOT 2
- Pass along bloblang/yaml error context
- kafka_franz: No connection errors if `consumer_group: ""`
- redis_streams: support for `XAUTOCLAIM`
- Docs typo in Configuration: Templating
- sql_insert - high CPU usage mainly due to GC cycles and allocations. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect.