- updated eventuateClientVersion
- updated Int128 usage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
|
||||
|
||||
import com.mongodb.WriteResult;
|
||||
import io.eventuate.Int128;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountChangeInfo;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountTransactionInfo;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.transactions.TransferState;
|
||||
@@ -29,7 +30,7 @@ public class AccountInfoUpdateService {
|
||||
}
|
||||
|
||||
|
||||
public void create(String accountId, String customerId, String title, BigDecimal initialBalance, String description, String version) {
|
||||
public void create(String accountId, String customerId, String title, BigDecimal initialBalance, String description, Int128 version) {
|
||||
try {
|
||||
AccountChangeInfo ci = new AccountChangeInfo();
|
||||
ci.setAmount(toIntegerRepr(initialBalance));
|
||||
@@ -40,7 +41,7 @@ public class AccountInfoUpdateService {
|
||||
.set("description", description)
|
||||
.set("balance", toIntegerRepr(initialBalance))
|
||||
.push("changes", ci)
|
||||
.set("creationDate", getFromEventId(version))
|
||||
.set("creationDate", new Date(version.getHi()))
|
||||
.set("version", version),
|
||||
AccountInfo.class);
|
||||
logger.info("Saved in mongo");
|
||||
@@ -81,12 +82,4 @@ public class AccountInfoUpdateService {
|
||||
set("transactions." + transactionId + ".status", status),
|
||||
AccountInfo.class);
|
||||
}
|
||||
|
||||
private Date getFromEventId(String eventId) {
|
||||
String[] s = eventId.split("-");
|
||||
if (s.length != 2) {
|
||||
return new Date();
|
||||
}
|
||||
return new Date(Long.parseUnsignedLong(s[0], 16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.ac
|
||||
import io.eventuate.DispatchedEvent;
|
||||
import io.eventuate.EventHandlerMethod;
|
||||
import io.eventuate.EventSubscriber;
|
||||
import io.eventuate.Int128;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.*;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.CreditRecordedEvent;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.DebitRecordedEvent;
|
||||
@@ -34,7 +35,7 @@ public class AccountQueryWorkflow {
|
||||
public void create(DispatchedEvent<AccountOpenedEvent> de) {
|
||||
AccountOpenedEvent event = de.getEvent();
|
||||
String id = de.getEntityId();
|
||||
String eventId = de.getEventId().asString();
|
||||
Int128 eventId = de.getEventId();
|
||||
logger.info("**************** account version=" + id + ", " + eventId);
|
||||
BigDecimal initialBalance = event.getInitialBalance();
|
||||
|
||||
@@ -57,8 +58,8 @@ public class AccountQueryWorkflow {
|
||||
String moneyTransferId = de.getEntityId();
|
||||
String fromAccountId = de.getEvent().getDetails().getFromAccountId();
|
||||
String toAccountId = de.getEvent().getDetails().getToAccountId();
|
||||
logger.info("**************** account version=" + fromAccountId + ", " + de.getEventId().asString());
|
||||
logger.info("**************** account version=" + toAccountId + ", " + de.getEventId().asString());
|
||||
logger.info("**************** account version=" + fromAccountId + ", " + eventId);
|
||||
logger.info("**************** account version=" + toAccountId + ", " + eventId);
|
||||
|
||||
AccountTransactionInfo ti = new AccountTransactionInfo(moneyTransferId,
|
||||
fromAccountId,
|
||||
|
||||
@@ -5,5 +5,5 @@ eventuateMavenRepoUrl=http://mavenrepo.eventuate.io/release
|
||||
|
||||
springBootVersion=1.3.5.RELEASE
|
||||
|
||||
eventuateClientVersion=0.10.0.RELEASE
|
||||
eventuateClientVersion=0.12.0.RELEASE
|
||||
eventuateLocalVersion=0.4.0.RELEASE
|
||||
|
||||
Reference in New Issue
Block a user