Complete the code to define the first step in a saga transaction.
producer.send('[1]', message);
The saga starts by sending a message to the order-created-topic to initiate the transaction.
Complete the code to consume messages for compensating transactions.
consumer.subscribe(['[1]']);
Compensating transactions listen on the payment-compensate-topic to rollback payment if needed.
Fix the error in the code that sends a compensation message.
producer.send('[1]', compensationMessage);
Compensation messages must be sent to the payment-compensate-topic to trigger rollback.
Fill both blanks to correctly define the saga step and its compensation topic.
const sagaStep = '[1]'; const compensationTopic = '[2]';
The saga step is updating inventory, and its compensation topic is order-compensate-topic to rollback order if needed.
Fill all three blanks to correctly map the saga steps to their compensation topics.
const steps = {
order: '[1]',
payment: '[2]',
inventory: '[3]'
};Each saga step has a corresponding compensation topic to handle rollbacks.