In this lecture, I'll show you how to use a delanoe, it's a very useful note, it actually does two
things.
It allows you to delay a message input and output by an arbitrary amount of time, but also to limit
the rate of messages that are passing through it, which is very useful if you want to connect your
flow to some external resource on the cloud.
For example, Google spreadsheet, those services typically introduce limits to how many messages they
can receive, and if you exceed them, then you're locked out, or at least you are limited by the imposed
rate limit.
So you can then use the delay node to ensure that your flow does not bombard an external service with
too many messages.
So let's have a look at this in practice here.
I've got a trigger that sent out the timestamp and I've got a debug note to show us the exact time stamp
at the moment, what I trigger it, and then the time stamp trigger will also start the delay node.
So I've got five seconds delay and after five seconds, the delayed message debug node will fire and
show us the payload five seconds later.
So let's try this out.
Looking at the current flow, I'm going to trigger that inject node.
And they go five seconds later, the same payload is let through by the DeLay node so he can see it
here.
Another thing that is interesting is this.
Let's say that I generate multiple timestamps within a small amount of time just by clicking on the
button here multiple times.
It looks like this.
So you can see that I've got a fairly high rate of messages being produced and all those are delayed
by five seconds and eventually they do appear just five seconds delayed.
Know, what I can do instead is I can say that I want to limit the rate of those messages and I want
to drop any intermediate messages so that only one message per second is actually able to pass through.
So let's see what the effect of this is.
I'm going to do multiple clicks on this button to simulate a high rate of messages passing through the
flow.
And that is what happens in the output in the delete message debug node.
OK, so I've got a bunch of royal messages here, you see the first delayed message did come through
and then I've got a bunch of royal messages until another message came through.
But these messages, you can see the time stamps should be of a second part.
So thirty eight.
Thirty eight seconds and then you've got thirty nine seconds.
Instead of having multiple messages coming through to match the rate by which I was clicking on the
button here to exaggerate a little bit more to make this a little bigger.
Five seconds.
So one message per five seconds and it drops the intermediate messages.
So those are totally lost for good.
Deploy that and clean up and I'm going to do a few consecutive clicks on the timestamp node.
OK, so let's go back to the beginning, his first delete message at 39, nine, 34, four minutes or
so, 39 minutes and 34 seconds.
And the next one.
So they put a number here for the next one.
It's right here, 39, exactly five seconds later, we have a single message coming out of the delayed
message, so we will be using the delay node in our project later on.