- @Override
- public void onReceive(Object message) throws Exception {
- if(message instanceof CreateTransaction){
- DOMStoreReadWriteTransaction transaction = chain.newReadWriteTransaction();
- ActorRef transactionActor = getContext().actorOf(ShardTransaction.props(transaction));
- getSender().tell(new CreateTransactionReply(transactionActor.path()), getSelf());
+ private void createTransaction(CreateTransaction createTransaction) {
+ DOMStoreReadWriteTransaction transaction =
+ chain.newReadWriteTransaction();
+ ActorRef transactionActor = getContext().actorOf(ShardTransaction
+ .props(chain, transaction, getContext().parent(), schemaContext), "shard-" + createTransaction.getTransactionId());
+ getSender()
+ .tell(ShardTransactionMessages.CreateTransactionReply.newBuilder()
+ .setTransactionActorPath(transactionActor.path().toString())
+ .setTransactionId(createTransaction.getTransactionId())
+ .build(),
+ getSelf());