Can source bucket for one Eventing Function be target for another Eventing Function


#1

I have two buckets called X and Y. Documents in each bucket have a type field.

I have set up the eventing service so that when documents in bucket X are updated I generate an update document in bucket Y.

I’m now trying to create another function so that when these update documents are added to Y I update the value of a document in bucket X (not the one that caused the initial event). However, this second function doesn’t seem to work. I’m wondering whether the problem is that by making bucket X the source for the first function it can no longer work as the target of the second function.

I’ve already spent some time trying to debug but haven’t had much luck. Is what I’m trying to do actually possible?

The functions filter on the ‘type’ attribute so there’s no way of triggering a circular update loop.

Any guidance would be appreciated.


#2

Editing my earlier response: please see the below reason of why it wouldn’t work.


#3

@venkat thanks for your response. Is there any timeframe around the GA release?


#4

@andrew1 : For now, we do not support or recommend the scenario you mentioned. Circular mutations will lead to many issues(cascading of function invocations) and we do not recommend it. Can you explain a little more on how this scenario exists in your design? Or do you see any possible workarounds.


#5

In my application I have a lesson document that contains an array of items. When the lesson is saved I want to update the states of all the items in the lesson.

In a highly simplified form say I have:
lesson:100 {
type: lesson,
items: [item:1, item:2, item:3].
updated_on: 1234
}

item:1 {
type: item,
updated_on
},
etc

When I save the lesson document I want to update all the item documents with the updated_on field from the lesson.

I would like to keep lesson and item documents in the same bucket to avoid multiple buckets on the server and having to run multiple replication processes on the client.


#6

Ability to update source bucket is not available for now, and is high on our roadmap. Once we have that feature, am sure you can do this in the same bucket - a.k.a content enrichment :slight_smile:

Thanks for this thread and the feedback.


#7

Thanks Venkat,
That would indeed be a great feature.

Not being able to edit documents in the source bucket (or add new ones) really reduces the usefulness of the Eventing service for now.

Any timeframe on the GA release for the Eventing Service?


#8

Managing recursive mutations is a tricky business and hence we did not allow it in the V1 of the product. But this is being targeted to be addressed soon.

As you know it is in Beta now, and we are looking at Summer for GA.