{"id":13511792,"url":"https://github.com/eventuate-tram/eventuate-tram-core","last_synced_at":"2025-05-14T07:08:19.914Z","repository":{"id":37251579,"uuid":"98709134","full_name":"eventuate-tram/eventuate-tram-core","owner":"eventuate-tram","description":"Transactional messaging for microservices","archived":false,"fork":false,"pushed_at":"2025-03-18T07:11:12.000Z","size":1638,"stargazers_count":1078,"open_issues_count":109,"forks_count":191,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-04-11T01:41:58.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eventuate-tram.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-29T04:50:55.000Z","updated_at":"2025-04-07T05:56:53.000Z","dependencies_parsed_at":"2024-01-13T19:25:05.525Z","dependency_job_id":"088fd683-af1e-49b9-9a0e-8f3c422b8103","html_url":"https://github.com/eventuate-tram/eventuate-tram-core","commit_stats":{"total_commits":487,"total_committers":7,"mean_commits":69.57142857142857,"dds":"0.49075975359342916","last_synced_commit":"68337f3c66098fbb61f059351932cb299d80c8ed"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventuate-tram%2Feventuate-tram-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventuate-tram%2Feventuate-tram-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventuate-tram%2Feventuate-tram-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventuate-tram%2Feventuate-tram-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eventuate-tram","download_url":"https://codeload.github.com/eventuate-tram/eventuate-tram-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092659,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T03:01:10.961Z","updated_at":"2025-05-14T07:08:19.886Z","avatar_url":"https://github.com/eventuate-tram.png","language":"Java","funding_links":[],"categories":["Java","微服务库"],"sub_categories":[],"readme":"= An Eventuate project\n\nimage::https://eventuate.io/i/logo.gif[]\n\nThis project is part of http://eventuate.io[Eventuate], which is a microservices collaboration platform.\n\n\n= Eventuate Tram (Transactional Messaging) platform\n\n[cols=\"a,a\"]\n|===\n| Spring/Micronaut\n| image::https://img.shields.io/maven-central/v/io.eventuate.tram.core/eventuate-tram-bom[link=\"https://search.maven.org/artifact/io.eventuate.tram.core/eventuate-tram-bom\"]\n| Quarkus\n| image::https://img.shields.io/maven-central/v/io.eventuate.tram.core/eventuate-tram-quarkus-bom[link=\"https://search.maven.org/artifact/io.eventuate.tram.core/eventuate-tram-bom\"]\n|===\n\n\nEventuate Tram is a platform that solves the distributed data management problems inherent in a http://microservices.io/patterns/microservices.html[microservice architecture].\n\nIt is described in more detail in my book https://www.manning.com/books/microservice-patterns[Microservice Patterns] and the http://eventuate.io/tram/gettingstarted.html[getting started guide].\n\n== Key benefits of Eventuate Tram\n\n++++\n\u003cdiv class=\"row\" style=\"background-color: rgba(238, 238, 238, 0.5)\"\u003e\n  \u003cdiv class=\"col-md-4\"\u003e\n    \u003ch4\u003eMaintain data consistency using sagas\u003c/h4\u003e\n    \u003cp\u003eImplement commands that update data in multiple microservices by using \u003ca href=\"https://microservices.io/patterns/data/saga.html\"\u003eSagas\u003c/a\u003e, which are sequences of local transactions coordinated using messages\u003c/p\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"col-md-4\"\u003e\n    \u003ch4\u003eImplement queries using CQRS\u003c/h4\u003e\n    \u003cp\u003eImplement queries that retrieve data from multiple services by using \u003ca href=\"https://microservices.io/patterns/data/cqrs.html\"\u003eCQRS views\u003c/a\u003e, which are easily queryable replicas maintained using events\u003c/p\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"col-md-4\"\u003e\n    \u003ch4\u003eCommunicate using transactional messaging\u003c/h4\u003e\n    \u003cp\u003eReliably send and receive messages and events as part of a database transaction by using the \u003ca href=\"https://microservices.io/patterns/data/application-events.html\"\u003eTransactional Outbox\u003c/a\u003e pattern\n  \u003c/div\u003e\n\u003c/div\u003e\n++++\n\n\n== How it works\n\nEventuate Tram provides several messaging abstractions:\n\n* messaging - send and receive messages over named channels\n* events - publish domain events and subscribe to domain events\n* commands - asynchronously send a command to a service and receive a reply\n\nEventuate Tram messaging implements the http://microservices.io/patterns/data/application-events.html[Transactional Outbox pattern].\nAn message producer inserts events into an `OUTBOX` table as part of the ACID transaction that updates data, such as JPA entities.\nA separate message relay (a.k.a. Eventuate CDC service) publishes messages to the message broker.\n\nimage::https://raw.githubusercontent.com/eventuate-tram/eventuate-tram-core/master/ReliablePublication.png[]\n\nThe Eventuate CDC service works in one of two ways:\n\n* http://microservices.io/patterns/data/transaction-log-tailing.html[Transaction log tailing] - currently implemented for MySQL and Postgres WAL\n* https://microservices.io/patterns/data/polling-publisher.html[Polling] - for other databases\n\n== Supported technologies\n\nLanguages:\n\n* Spring Boot\n* Micronaut\n* Quarkus - see https://github.com/eventuate-tram/eventuate-tram-core-quarkus\n* .NET - see https://github.com/eventuate-tram/eventuate-tram-core-dotnet[this project]\n\nDatabases:\n\n* MySQL - https://microservices.io/patterns/data/transaction-log-tailing.html[transaction log tailing] using the MySQL binlog\n* Postgres - https://microservices.io/patterns/data/transaction-log-tailing.html[transaction log tailing] using the Postgres WAL\n* Other databases including Microsoft SQL server - https://microservices.io/patterns/data/polling-publisher.html[polling]\n\nMessage brokers:\n\n* Apache Kafka\n* ActiveMQ\n* RabbitMQ\n* Redis Streams\n\n== Getting started\n\nPlease see the http://eventuate.io/tram/gettingstarted.html[getting started guide].\n\n== Example applications\n\nThere are numerous example applications:\n\n* https://github.com/eventuate-tram/eventuate-tram-core-examples-basic[Basic examples]\n* https://github.com/eventuate-tram/eventuate-tram-examples-customers-and-orders[Customers and Orders] - illustrates choreography-based sagas and CQRS\n* https://github.com/eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders[Customers and Orders]  - illustrates orchestration-based sagas using the https://github.com/eventuate-tram/eventuate-tram-sagas[Eventuate Tram Sagas framework]\n* https://github.com/microservice-patterns/ftgo-application[FTGO Example application for Microservice Patterns book]\n\n== Got questions?\n\nDon't hesitate to create an issue or see\n\n* https://groups.google.com/d/forum/eventuate-users[Mailing list]\n* https://join.slack.com/t/eventuate-users/shared_invite/enQtNTM4NjE0OTMzMDQ3LTc3ZjYzYjYxOGViNTdjMThkZmVmNWQzZWMwZmQyYzhjNjQ4OTE4YzJiYTE2NDdlOTljMDFlMDlkYTI2OWU1NTk[Slack Workspace]\n* http://eventuate.io/contact.html[Contact us].\n\n== Need support?\n\nTake a look at the http://eventuate.io/support.html[available paid support] options.\n\n== Transactional messaging\n\nSend a message using `MessageProducer`:\n\n```java\npublic interface MessageProducer {\n  void send(String destination, Message message);\n}\n```\n\nReceive messages using:\n\n```java\npublic interface MessageConsumer {\n  void subscribe(String subscriberId, Set\u003cString\u003e channels, MessageHandler handler);\n}\n```\n\nSee this example of https://github.com/eventuate-tram/eventuate-tram-core-examples-basic/blob/master/eventuate-tram-examples-common/src/main/java/io/eventuate/tram/examples/basic/messages/AbstractTramMessageTest.java[transactional messaging].\n\n=== Transactional domain events\n\nThe domain event package builds on the core APIs.\n\nPublish domain events using the `DomainEventPublisher` interface:\n\n```java\npublic interface DomainEventPublisher {\n\n  void publish(String aggregateType, Object aggregateId, List\u003cDomainEvent\u003e domainEvents);\n  ...\n```\n\nSubscribe to domain events using a `DomainEventDispatcher`:\n\n```java\npublic class DomainEventDispatcher {\n    public DomainEventDispatcher(String eventDispatcherId,\n                DomainEventHandlers eventHandlers,\n                ...) {\n...\n}\n```\n\nHandle the events using `DomainEventHandlers`:\n\n```java\npublic class RestaurantOrderEventConsumer {\n\n  public DomainEventHandlers domainEventHandlers() {\n    return DomainEventHandlersBuilder\n            .forAggregateType(\"net.chrisrichardson.ftgo.restaurantservice.Restaurant\")\n            .onEvent(RestaurantMenuRevised.class, this::reviseMenu)\n            .build();\n  }\n\n  public void reviseMenu(DomainEventEnvelope\u003cRestaurantMenuRevised\u003e de) {\n```\n\nSee this example of https://github.com/eventuate-tram/eventuate-tram-core-examples-basic/blob/master/eventuate-tram-examples-common/src/main/java/io/eventuate/tram/examples/basic/events/AbstractTramEventTest.java[transaction events].\n\n== Transactional commands\n\nTransaction commands are implemented using transactional messaging.\n\nSend a command using a `CommandProducer`:\n\n```java\npublic interface CommandProducer {\n  String send(String channel, Command command, String replyTo, Map\u003cString, String\u003e headers);\n  ...\n}\n```\n\nSubscribe to commands using a `CommandDispatcher`:\n\n```java\npublic class CommandDispatcher {\n\n  public CommandDispatcher(String commandDispatcherId,\n           CommandHandlers commandHandlers) {\n  ...\n}\n```\n\nHandle commands and send a reply using `CommandHandlers`:\n\n```java\npublic class OrderCommandHandlers {\n\n\n  public CommandHandlers commandHandlers() {\n    return CommandHandlersBuilder\n          .fromChannel(\"orderService\")\n          .onMessage(ApproveOrderCommand.class, this::approveOrder)\n          ...\n          .build();\n  }\n\n  public Message approveOrder(CommandMessage\u003cApproveOrderCommand\u003e cm) {\n    ApproveOrderCommand command = cm.getCommand();\n    ...\n  }\n\n```\n\nSee this example of https://github.com/eventuate-tram/eventuate-tram-core-examples-basic/blob/master/eventuate-tram-examples-common/src/main/java/io/eventuate/tram/examples/basic/commands/AbstractTramCommandTest.java[transactional commands].\n\n== Maven/Gradle artifacts\n\nThe artifacts are in https://bintray.com/eventuateio-oss/eventuate-maven-release/eventuate-tram[JCenter].\nThe latest version is:\n\n[cols=\"5%,20%a\"]\n|===\n| RC | image::https://api.bintray.com/packages/eventuateio-oss/eventuate-maven-rc/eventuate-tram/images/download.svg[link=\"https://bintray.com/eventuateio-oss/eventuate-maven-rc/eventuate-tram/_latestVersion\"]\n| Release | image::https://api.bintray.com/packages/eventuateio-oss/eventuate-maven-release/eventuate-tram/images/download.svg[link=\"https://bintray.com/eventuateio-oss/eventuate-maven-release/eventuate-tram/_latestVersion\"]\n|===\n\n\n\nThere are the following API artifacts:\n\n* `io.eventuate.tram.core:eventuate-tram-messaging:$eventuateTramVersion` - core messaging APIs\n* `io.eventuate.tram.core:eventuate-tram-events:$eventuateTramVersion` - domain event API\n* `io.eventuate.tram.core:eventuate-tram-commands:$eventuateTramVersion` - commands/reply API\n\nThere are the following 'implementation' artifacts:\n\n* `io.eventuate.tram.core:eventuate-tram-jdbc-kafka:$eventuateTramVersion` - JDBC database and Apache Kafka message broker\n* `io.eventuate.tram.core:eventuate-tram-jdbc-activemq:$eventuateTramVersion` - JDBC database and Apache ActiveMQ message broker\n* `io.eventuate.tram.core:eventuate-tram-jdbc-rabbitmq:$eventuateTramVersion` - JDBC database and RabbitMQ message broker\n* `io.eventuate.tram.core:eventuate-tram-jdbc-redis:$eventuateTramVersion` - JDBC database and Redis Streams\n* `io.eventuate.tram.core:eventuate-tram-in-memory:$eventuateTramVersion` - In-memory JDBC database and in-memory messaging for testing\n\n== Running the CDC service\n\nIn addition to a database and message broker, you will need to run the Eventuate Tram CDC service.\nIt reads events inserted into the database and publishes them to the message broker.\nIt is written using Spring Boot.\nThe easiest way to run this service during development is to use Docker Compose.\nThe https://github.com/eventuate-tram/eventuate-tram-core-examples-basic[Eventuate Tram Code Basic examples] project has an example docker-compose.yml file.\n\n== Contributing\n\nContributions are welcome.\n\nPlease sign a https://chrisrichardson.net/legal/[contributor license agreement].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventuate-tram%2Feventuate-tram-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feventuate-tram%2Feventuate-tram-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventuate-tram%2Feventuate-tram-core/lists"}