Giter Club home page Giter Club logo

eventuate-tram-examples-customers-and-orders's Introduction

An Eventuate project

logo

This project is part of Eventuate, which is a microservices collaboration platform.

Eventuate Tram Customers and Orders

This application demonstrates two key patterns:

  • Sagas - implement transactions that span services

  • CQRS - implement queries that retrieve data from multiple services.

The application consists of three services:

  • Order Service - manages orders

  • Customer Service - manages customers

  • Order History Service - maintains the order history

All services are implemented using Spring Boot, JPA and the Eventuate Tram framework, which provides transactional publish/subscribe.

The Order Service uses a choreography-based saga to enforce the customer’s credit limit when creating orders.

The Order History Service implements a CQRS view and subscribes to domain events published by the Order Service and Customer Service

About Sagas

Sagas are a mechanism for maintaining data consistency in a microservice architecture. A saga is a sequence of transactions, each of which is local to a service.

There are two main ways to coordinate sagas: orchestration and choreography. This example uses choreography-based sagas, which use domain events for coordination. Each step of a saga updates the local database and publishes a domain event. The domain event is processed by an event handler, which performs the next local transaction.

To learn more about why you need sagas if you are using microservices:

The Create Order saga

The saga for creating an Order consists of the follow steps:

  1. The Order Service creates an Order in a PENDING state and publishes an OrderCreated event

  2. The Customer Service receives the event attempts to reserve credit for that Order. It publishes either a Credit Reserved event or a CreditLimitExceeded event.

  3. The Order Service receives the event and changes the state of the order to either APPROVED or REJECTED.

About Command Query Responsibility Segregation (CQRS)

The CQRS pattern implements queries that retrieves data from multiple services. It maintains a queryable replica of the data by subscribing to domain events published by the services that own the data.

In this example, the Order History Service maintains a CQRS view in MongoDB by subscribing to domain events published by the Order Service and Customer Service. The CQRS view stores each customer as a MongoDB document that contains information the customer and their orders.

To learn more about why you need CQRS if you are using microservices:

Transactional messaging with Eventuate Tram

The services uses the Eventuate Tram framework to communicate asynchronously using events. The flow for publishing a domain event using Eventuate Tram is as follows:

  1. Eventuate Tram inserts events into the MESSAGE table as part of the ACID transaction that updates the JPA entity.

  2. The Eventuate Tram CDC service tracks inserts into the MESSAGE table using the MySQL binlog (or Postgres WAL) and publishes messages to Apache Kafka.

  3. A service subscribes to the events, updates its database, and possibly publishes more events.

Architecture

The following diagram shows the architecture of the Customers and Orders application.

Eventuate Tram Customer and Order Architecture

The application consists of three services: Customer Service, Order Service, and Order History Service

Customer Service

The Customer Service implements a REST API for managing customers. The service persists the Customer JPA entity in a MySQL/MsSQL/Postgres database. Using Eventuate Tram, it publishes Customer domain events that are consumed by the Order Service.

For more information, see the microservice canvas for the Customer Service.

customer service canvas

Order Service

The Order Service implements REST API for managing orders. The service persists the Order JPA entity in MySQL/MsSQL/Postgres database. Using Eventuate Tram, it publishes Order domain events that are consumed by the Customer Service.

For more information, see the microservice canvas for the Order Service.

order service canvas

Order History Service

The Order History Service implements REST API for querying a customer’s order history This service subscribes to events published by the Order Service and Customer Service and updates a MongoDB-based CQRS view.

For more information, see the microservice canvas for the Order History Service.

order history service canvas

Building and running

Note: you do not need to install Gradle since it will be downloaded automatically. You just need to have Java 8 installed.

First, build the application

./gradlew assemble

Next, launch the services using Docker Compose:

./gradlew mysqlbinlogComposeBuild mysqlbinlogComposeUp

Note:

If the containers aren’t accessible via localhost - e.g. you are using Docker Toolbox, you will have to use ${DOCKER_HOST_IP} instead of localhost. See this guide to setting DOCKER_HOST_IP for more information.

You can also run the MsSQL version using ./gradlew mssqlpollingComposeUp or Postgres version using ./gradlew postgreswalComposeUp

Using the application

Once the application has started, you can use the application via the Swagger UI:

You can also use curl to interact with the services. First, let’s create a customer:

$ curl -X POST --header "Content-Type: application/json" -d '{
  "creditLimit": {
    "amount": 5
  },
  "name": "Jane Doe"
}' http://localhost:8082/customers

HTTP/1.1 200
Content-Type: application/json;charset=UTF-8

{
  "customerId": 1
}

Next, create an order:

$ curl -X POST --header "Content-Type: application/json" -d '{
  "customerId": 1,
  "orderTotal": {
    "amount": 4
  }
}' http://localhost:8081/orders

HTTP/1.1 200
Content-Type: application/json;charset=UTF-8

{
  "orderId": 1
}

Next, check the status of the Order in the Order Service:

$ curl -X GET http://localhost:8081/orders/1

HTTP/1.1 200
Content-Type: application/json;charset=UTF-8

{
  "orderId": 1,
  "orderState": "APPROVED"
}

Finally, look at the customer’s order history in the Order History Service:

$ curl -X GET --header "Accept: */*" "http://localhost:8083/customers/1"

HTTP/1.1 200
Content-Type: application/json;charset=UTF-8

{
  "id": 1,
  "orders": {
    "1": {
      "state": "APPROVED",
      "orderTotal": {
        "amount": 4
      }
    }
  },
  "name": "Chris",
  "creditLimit": {
    "amount": 100
  }
}

Got questions?

Don’t hesitate to create an issue or see

eventuate-tram-examples-customers-and-orders's People

Contributors

cer avatar dartartem avatar pranaysahith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eventuate-tram-examples-customers-and-orders's Issues

org.apache.kafka.common.KafkaException: Failed to construct kafka producer

Java Version:

PS C:\GitHub\eventuate-tram\eventuate-tram-examples-customers-and-orders> java -version openjdk version "1.8.0_322" OpenJDK Runtime Environment Corretto-8.322.06.1 (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM Corretto-8.322.06.1 (build 25.322-b06, mixed mode) PS C:\GitHub\eventuate-tram\eventuate-tram-examples-customers-and-orders>

Gradle Build:

`
PS C:\GitHub\eventuate-tram\eventuate-tram-examples-customers-and-orders> ./gradlew

BUILD SUCCESSFUL in 881ms
1 actionable task: 1 executed

`

./gradlew buildAndStartServicesMySql

`
o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventuateKafkaProducer' defined in class pa
th resource [io/eventuate/tram/cdc/connector/configuration/KafkaMessageTableChangesToDestinationsConfiguration.class]: Bean instantia
tion via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.e
ventuate.messaging.kafka.producer.EventuateKafkaProducer]: Factory method 'eventuateKafkaProducer' threw exception; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka producer
at
`

See the attached log file:

command_line_response.txt

Building/Rebuilding CQRS views

Building/Rebuilding CQRS views
Problem

Let’s imagine that the Eventuate Tram Customers and Orders project was running in production. You then wanted to add the Order History View - #1

You need to populate the order history views - Customer and Order MongoDB tables - with the existing data.
Assumptions
Let’s focus on Kafka for now
Solution

Note:
The goal is to build a framework that makes it easier to implement this behavior for any service/application
In the meantime, let’s just focus on the Eventuate Tram customer and orders application
Exporting data from a service

A service must expose an API for triggering the export behavior.

An export consists of an AggregateSnapshot event, which is an event containing a snapshot of the aggregate’s state.

A service (Order Service, Customer Service) exports its data as follows:
Lock table
This ensures that any domain events representing an update to an aggregate will follows the aggregate’s Order/CustomerSnapshotEvent
Publish StartOfSnapshots events to Order/Customer channel (topic) to indicate starting offset
Since the table is locked, the offset is the starting point for the consumer to read the Snapshot events.
Publish one StartOfSnapshots event to each partition in the topic using round robin with a null message key
Iterate through Orders/Customers and publish an (Customer/Order)Snapshot event for each one to the Order/Customer
The event containers the complete state of the Order/Customer
Perhaps one day use Spring batch
Unsure whether this is needed
Publish End Of Snapshots events to channel to indicate done
Unlock table
Importing data into a CQRS view service

The OrderHistoryService subscribes to (Customer/Order)Snapshot and updates the view appropriately.

One all of the services (Customer and Order) have published their StartOfSnapshots events and the Kafka consumer offsets are known:
Change the kafka consumer offsets for the OrderHistoryService’s subscription to the specified point offsets
Start the OrderHistoryService

docker-compose run executed by migration script files with the input device is not a TTY

curl -s https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/master/migration/db-id/migration.sh &> /dev/stdout | bash

Now fails with the input device is not a TTY here

https://github.com/eventuate-foundation/eventuate-common/blob/950c6811ef19a9056efd24fd7ed3daf86f1bc1b1/migration/db-id/migration.sh#L57 :

  docker-compose -f ${migration_tool} run --no-deps mssql-migration

How to retry consumption?

@Autowired
FeignClient client;

public Message consumption_must_success_eventually(CommandMessage<RemoteActionCommand> cm) {
    ....
    // it may throw an exception (like a momentary network glitch)
    client.invokeRpc();
    withSuccess();
}

Thanks!

Building service "customerservice" failed: Invalid interpolation format for "build" option in service "customerservice": "${EVENTUATE_JAVA_BASE_IMAGE_VERSION?}"

I am getting the following error when running:

./gradlew mysqlbinlogComposeBuild mysqlbinlogComposeUp

Task :mysqlbinlogComposeBuild
Invalid interpolation format for "build" option in service "customerservice": "${EVENTUATE_JAVA_BASE_IMAGE_VERSION?}"

How must EVENTUATE_JAVA_BASE_IMAGE_VERSION be set?

Environment:
Linux Mint 20
Java: openjdk version "1.8.0_275"

How to guarantee the order commands

In this project, I think that the CDC service and Kafka provided will not guarantee the order for commands with overlapping sequences due to the two Kafka partitions. Is there a way to ensure order?

Simplify working with rest

JSonMapper.fromJson(restTemplate.postForObject(baseUrlCustomers("customers/make-snapshot"), null, String.class), TopicPartitionOffset[].class

First, this should be simplified to

restTemplate.postForObject(baseUrlCustomers("customers/make-snapshot"), null, TopicPartitionOffset[].class)

also it is better to wrap arrays to object

Need to retry MongoDB upserts

Need to retry DuplicateKeyException thrown by upserts.

This occurred when deploying on Fargate with DocumentDB:

org.springframework.dao.DuplicateKeyException: E11000 duplicate key error collection: customerView index: _id_; nested exception is com.mongodb.MongoWriteException: E11000 duplicate key error collection: customerView index: _id_
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:101)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2781)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:547)
at org.springframework.data.mongodb.core.MongoTemplate.doUpdate(MongoTemplate.java:1578)
at org.springframework.data.mongodb.core.MongoTemplate.doUpdate(MongoTemplate.java:1568)
at org.springframework.data.mongodb.core.MongoTemplate.upsert(MongoTemplate.java:1514)
at io.eventuate.examples.tram.ordersandcustomers.orderhistory.backend.CustomerViewRepositoryImpl.addOrder(CustomerViewRepositoryImpl.java:31)

Apparently, this is a feature:

https://jira.mongodb.org/browse/SERVER-14322

Support test on java 14

docker image differences along with

targetCompatibility = '8'
sourceCompatibility = '8'

can just be parameterized ./gradlew -P x=y

There is no need for a branch. CircleCI can have a job that installs java 14 and builds with these parameters.

Build 627 failed. Order state is pending instead of rejected

see: https://app.circleci.com/pipelines/github/eventuate-tram/eventuate-tram-examples-customers-and-orders/147/workflows/1cbcbce6-1360-4b23-8e08-f071ee5fccbf/jobs/627

Problem:
Eventuate cdc service caches primary keys:

https://github.com/eventuate-foundation/eventuate-cdc/blob/0ada218b4228f03bf9d967968dc178e16010cce6/eventuate-local-java-cdc-connector-polling/src/main/java/io/eventuate/local/polling/PollingDao.java#L34

https://github.com/eventuate-foundation/eventuate-cdc/blob/0ada218b4228f03bf9d967968dc178e16010cce6/eventuate-local-java-cdc-connector-polling/src/main/java/io/eventuate/local/polling/PollingDao.java#L203-L219

After db id migration primary key column is changed.
New message records after migration have empty old primary key.
When any new message processed, all new records marked as published,
because have empty old primary key (and cdc uses it when marks event published), so some messages were ignored by cdc.

Solution:
Restart cdc service after migration.

Build 151 failed

Build https://app.circleci.com/pipelines/github/eventuate-tram/eventuate-tram-examples-customers-and-orders/151/workflows/2a8c7505-7ed5-4108-a5e9-b1b7c845a629/jobs/651/steps failed

Reason: build-and-test-snapshots.sh failed

*Reason: Failed io.eventuate.examples.tram.ordersandcustomers.snapshottests.SnapshotTest testCustomers

**Reason: I/O error on GET request for "http://localhost:8084/customers": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)

***Reason: docker-compose failed to start eventuate-tram-examples-customers-and-orders_order-history-text-search-service_2

****Reason: ERROR: for eventuate-tram-examples-customers-and-orders_order-history-text-search-service_2 Cannot start service order-history-text-search-service: driver failed programming external connectivity on endpoint eventuate-tram-examples-customers-and-orders_order-history-text-search-service_2 (0a3fca82cb3f008c791cb248399a5dfa7b15c30f38e70bc8ccbba1b0621cf112): Bind for 0.0.0.0:8084 failed: port is already allocated

*****Reason: there is already eventuate-tram-examples-customers-and-orders_order-history-text-search-service_1

******Reason: order-history-text-search-service starts by ordersTest and customersTest. ordersTest executed first. It tried to start order-history-text-search-service, which depends on elastic search, and while elastic search is pulled, order-history-text-search-service started timeout is elapsed. So, customersTest started creating order-history-text-search-service concurrently

Solution: Increase timeouts start elastic search before order-history-text-search-service

Build failed because of mssql tests

See: https://app.circleci.com/pipelines/github/eventuate-tram/eventuate-tram-examples-customers-and-orders/140/workflows/814318e7-8113-4b07-9f4d-1aad7a436133/jobs/580

Error in logs:

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select top (?) * FROM eventuate.message WHERE published = 0 ORDER BY id ASC]; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'eventuate.message'.
	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:234) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1444) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:694) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForRowSet(NamedParameterJdbcTemplate.java:307) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForRowSet(NamedParameterJdbcTemplate.java:315) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at io.eventuate.local.polling.PollingDao.lambda$processEvents$1(PollingDao.java:124) [eventuate-local-java-cdc-connector-polling-0.10.0.DB_ID_GEN.BUILD-SNAPSHOT.jar!/:na]
	at io.eventuate.local.common.DaoUtils.handleConnectionLost(DaoUtils.java:22) ~[eventuate-local-java-cdc-connector-common-0.10.0.DB_ID_GEN.BUILD-SNAPSHOT.jar!/:na]
	at io.eventuate.local.polling.PollingDao.processEvents(PollingDao.java:122) [eventuate-local-java-cdc-connector-polling-0.10.0.DB_ID_GEN.BUILD-SNAPSHOT.jar!/:na]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_252]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_252]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_252]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_252]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_252]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_252]
	at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:541) ~[na:1.8.0_252]
	at io.eventuate.local.polling.PollingDao.start(PollingDao.java:97) [eventuate-local-java-cdc-connector-polling-0.10.0.DB_ID_GEN.BUILD-SNAPSHOT.jar!/:na]
	at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_252]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'eventuate.message'.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:256) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:592) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:522) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2930) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:444) ~[mssql-jdbc-7.2.1.jre8.jar!/:na]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52) ~[HikariCP-3.2.0.jar!/:na]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java) ~[HikariCP-3.2.0.jar!/:na]
	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:678) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
	... 16 common frames omitted

Prably reason is eventuate-foundation/eventuate-common#71

Services built using Maven randomly fail to when build using Java 8

  • This problem first appeared when the CircleCI build was switched from Java 14 back to Java 8.
  • The containers always used Java 8 even when Maven was running using Java 14
  • This mostly could not be reproduced locally
  • The exception was due to some annotation introspection problem on startup
  • The Spring Boot plugin seems to sometimes build a fat jar that is missing common-swagger

Typo in SQL script?

Is this a typo (or just a confusing ordering, appearing just below the creation of the "entities" table, but adding an index to a different table)?

CREATE INDEX entities_idx ON events(entity_type, entity_id);

Which of these env vars are needed?

SPRING_DATASOURCE_URL: jdbc:sqlserver://mssql:1433;databaseName=eventuate

e.g. Doesn't the CDC have sensible defaults for polling?

      SPRING_DATASOURCE_TEST_ON_BORROW: "true"
      SPRING_DATASOURCE_VALIDATION_QUERY: SELECT 1
      EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
      EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
      EVENTUATELOCAL_CDC_POLLING_INTERVAL_IN_MILLISECONDS: 500
      EVENTUATELOCAL_CDC_MAX_EVENTS_PER_POLLING: 1000
      EVENTUATELOCAL_CDC_MAX_ATTEMPTS_FOR_POLLING: 100
      EVENTUATELOCAL_CDC_POLLING_RETRY_INTERVAL_IN_MILLISECONDS: 500

Failed CustomerViewRepositoryIntegrationTest

step to reproduce:

  1. git clone the repo
  2. ./mvnw clean install

expected:

  • All tests passed
    actual result:
  • build failed

[INFO] order-history-backend .............................. FAILURE [ 2.519 s]

The same when doing it via idea.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]: Unresolvable class definition; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/KotlinDetector

How to replay all the events for certain service?

Let's say orderservice crashed and lost all the data (not in this example, since order and customer share same db here), how can we replay all the events and restore its latest state?

In io.eventuate.local.db.log.common.DbLogBasedCdcProcessor,

  public void start(Consumer<EVENT> eventConsumer) {
    Optional<BinlogFileOffset> startingBinlogFileOffset = offsetStore.getLastBinlogFileOffset();

    process(eventConsumer, startingBinlogFileOffset);
  }

The offsetStore always seeks to the latest offset even though its consumer starts at the earliest.

I guess we can either make it configurable or provide a different implementation of the CdcProcessor.

But the question is, while we replay all the events, the orderservice will emit new events as well, and those events are already published and stored in the event store. So, what do we do? publish them to a separated Topic? What's the recommended operation? Or, is it really practical?

Debug and restore snapshot functionality

  • kafka-consumer-groups --bootstrap-server kafka:29092 --reset-offsets appears not to support setting offsets of individual partitions.
  • This testing should be moved back to view support

Build Failure - Exception in phase 'semantic analysis' in source unit ServicePlugin.groovy Unsupported class file major version 61

I am using IntelliJ. I tried both SDK corretto-1.8 and openjdk-17

I receive the following build failure:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit 'C:\GitHub\eventuate-tram\eventuate-tram-examples-customers-and-orders\buildSrc\src\main\groovy\ServicePlugin.groovy' Unsupported class file major version 61

Order Service/Customer Service cannot connect to SQL server - The driver could not establish a secure connection to SQL Server

Unclear why this started to happen with 884c4ba:

Eventuate CDC connects without issue.

  2023-10-15 17:33:29.089  INFO [customer-service,,] 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
  2023-10-15 17:33:31.216 ERROR [customer-service,,] 1 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.
  
  com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:f9546012-b5ed-4e53-801a-ba7b3449f429

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.