UncommittedDataListener
UncommittedDataListener
provides one method to be aware of uncommitted data submitting failures to the admin temporally.
As per the architecture you know that if the event-store is failed some case while the processing that data (the data was unable to commit to the even-store) is transferred to the admin server temporally. if your admin servers are also running at the moment there is nothing to do. therefore the framework notifies it through the UncommittedDataListener
. the application can have many implementations of UncommittedDataListener
. and those are executed thorough the sagaEventExecutor
ThreadPool.
Sample implementation
Here is a sample implementation of UncommittedDataListener
.
import org.springframework.stereotype.Component;
import org.stacksaga.core.UncommittedData;
import org.stacksaga.core.listener.UncommittedDataListener;
@Component
public class UncommittedDataListenerImpl implements UncommittedDataListener {
@Override
public void onFailed(UncommittedData uncommittedData) {
System.out.println("uncommittedDataUid:" + uncommittedData.getUncommittedDataUid()); (1)
System.out.println("aggregatorName:" + uncommittedData.getUncommittedDataUid()); (2)
System.out.println("aggregatorVersion:" + uncommittedData.getAggregatorVersion()); (3)
System.out.println("transactionUid:" + uncommittedData.getTransactionUid()); (4)
System.out.println("serviceName:" + uncommittedData.getServiceName()); (5)
System.out.println("Json data as byte array:" + new String(uncommittedData.getBinaryData())); (6)
}
}
-
The unique ID for the dataset that was trying to be sent to the admin server.
-
The aggregator’s name which was affected to the failure.
-
The version of the aggregator which was affected to the failure.
-
The transaction unique id regarding the aggregator transaction.
-
The service name of the aggregator. (All the time the server name will be equal to the service name that you are in.)
-
The dataset which was sending to the admin-server due to event-store database connection failure. the dataset is in JSON binary form.