Comments (10)
What is the use case behind it?
from sailor-nodejs.
Actually the story is a bit tricky - check this out:
https://github.com/elasticio/amqp-component/blob/master/lib/triggers/consume.js#L55
AMQP trigger is like some others (salesforce streaming, twitter streaming, google pubsub etc) are passive listening triggers, they need to be started once and then they produce data when data is there. When using such trigger in long-running task it works very well.
However as you you know our admiral has a special timeout feature so when incoming message accepted wherever the trigger wants it or not, in this case the init
method:
https://github.com/elasticio/amqp-component/blob/master/lib/triggers/consume.js#L17
will be called only once, but process
method will be called multiple times. Simple solution would be to move all code into the init
method and leave process
method empty, like that:
elasticio/amqp-component@75c1665
this however does not work because this
at the time init
is executed is not the same this
at the time process
is executed ;)
from sailor-nodejs.
I see. The use case is very nice.
So, what we have is a trigger that is neither polling
nor webhook
. Wouldn't make sense to introduce a new trigger type, say listener
? This would be accomplished in component.json by setting "type":"listener"
, in the same way we define polling
triggers right now. For such listener
triggers the process
function would be invoked only once to start listening on queues.
from sailor-nodejs.
Very interesting idea. Actually the solution described above does only work with the 'realtime' flow. If we would declare a new trigger type we could make sure Admiral won't kill it even in case of non-realtime flow hence save resources.
I also see this as a first step to 'unload' webhooks
functionality and potentially in future to load-balance TCP connections from outside to containers hence enable new protocol support (e.g. MTOM) in user-space.
from sailor-nodejs.
Actually the solution described above does only work with the 'realtime' flow.
Does a listener
trigger type make any sense in a non-realtime flow?
from sailor-nodejs.
from sailor-nodejs.
But the trigger container must be realtime and running all the time for that purpose anyway, right? Otherwise it won't get any messages.
from sailor-nodejs.
from sailor-nodejs.
Sorry, but i don't get it. The trigger creates a consumer and subscribes it. If the container is killed, the consumer is unregistered. Admiral does not know anything the queue the trigger is consuming message from. Am I missing something?
from sailor-nodejs.
My point was that, just like you said:
the trigger container must be realtime and running all the time for that purpose anyway
so if we introduce new trigger type then we need to make sure that admiral
won't kill it, even if the overal flow type won't be real-time. Which is very good because if non-realtime flow with first 'listener' trigger then all other containers will be started on-demand, and shut-down if no messages were produced by the listening trigger, which is cool.
from sailor-nodejs.
Related Issues (20)
- logger should be accessible in the startup init and shutdown methods HOT 1
- Test sailor-nodejs on popeye stage in order to check if new rabbitMQ version will not break everything
- Update Sailor Tests
- Update Sailor Dependencies
- Sailor enhancement: have this.emit() function be defined consistently for all methods called through Sailor
- Emitting errors should work, and they should be displayed on the platform
- Remove Travis CI from Sailor and set up Circle CI
- Sailor enhancement: set custom timeout length with env variable HOT 1
- updateKeys should work as intended from all functions
- Update Sailor README to include more relevant information for developers
- Wrap component trigger results into JsonObject HOT 2
- Proposal: exposing the option to parallelize actions/triggers HOT 4
- Add a Changelog to this repo
- Replace Q with native Promise
- Sailor does not reliably publish large messages HOT 5
- Preserve flow execution after 20 minutes if it do any activity HOT 4
- Passthrough step loss HOT 5
- Make sure sensitive data is not logged in components
- Sailor should be more tolerant of invalid `LOG_LEVEL` values
- Sailor should auto-rebound when it encounters an HTTP timeout in a component's process function
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 sailor-nodejs.