I’m creating the feed based on “FromOrders”, because I want to be notified at every stage of the process.
I grabbed the command to create the feed from this page: Orders API, and ran it successfully:
My question / problem is:
“expression”:“value > 100”
The documentation says this is an expression that needs to be true in order to add to the queue… But I don’t want orders with a value greater than 100 — I want all orders. However, if I remove that property from the JSON, I can’t create the Feed.
What should the JSON look like to use FromOrders and include all orders, regardless of any condition?
Hello Renata (@renatagrebogy), welcome to the VTEX Community!
The Orders Feed V3 works with two types of filters. The FromOrders filter that you’re currently using, but there’s also the FromWorkflow filter, which might be the best solution for filtering orders based on their status instead of filtering using the order data.
Another important point is that the Orders Feed is a passive architecture, meaning you need to poll it to check if there are any orders matching your filter, and after reading an order, you still need to commit it so it’s removed from the queue.
With the Orders Hook, on the other hand, you can configure an endpoint to be notified whenever a new order is created, using the same filtering approach with either FromOrders or FromWorkflow.
I also recommend checking out the documentation below, which includes several examples and explains many details about both the Order Feed and the Order Hook — it should help you understand each context and its particularities.
We’re using the V3 feed with the FromOrders option for a billing integration.
Another question that came up:
Is there an option in the VTEX admin environment to force an order that has already been sent to appear in the feed again?
For example: let’s say that, for some reason, the integrator stops working for a period longer than the MessageRetentionPeriodInSeconds and the customer wants to force those orders to go through again — is that possible?
My preferred approach is to configure an OrderHook to send order notifications with the desired statuses to an endpoint that simply receives the notification from VTEX and forwards it to a FIFO queue using Amazon SQS (for example), to first ensure the notification coming from VTEX is captured.
Then, in a separate service, I create a worker to process the queue — precisely so that if something goes wrong while processing a notification, it stays in the queue until the worker is able to handle it.
This way, the “notification capture” and “notification processing” steps remain independent and reliable.
As for Order Feed, from what I remember, whenever an order is updated it goes back into the queue — meaning the only way to force an item back into the queue is if there’s a rule in the expression that matches that update.
I’m not sure if you’ve already seen the documentation that @eduardo.luciano published here in the community with a lot of detail about Order Feed and Order Hook. It’s worth a read to determine whether Order Feed is really the best fit for your case, or whether it’s worth going with Order Hook instead.