Coder Social home page Coder Social logo

ingdex / rocketmq-eventbridge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apache/rocketmq-eventbridge

0.0 0.0 0.0 2.84 MB

Apache rocketmq

Home Page: https://rocketmq.apache.org/

License: Apache License 2.0

Java 99.62% Dockerfile 0.15% Shell 0.23%

rocketmq-eventbridge's Introduction

Apache RocketMQ EventBridge

RocketMQ EventBridge is a subproject of rocketmq to make it easier to build event-driven applications. In addition, rocketmq-eventbridge can route events between many services and applications based on the standard CloudEvents 1.0 specification. Users can use rocketmq-eventbridge to build loosely coupled and distributed event-driven architectures.

Architecture

Events are sent to the event bus in two ways: 1) Push events through the SDK or Webhook actively; 2) Pulled events by eventbridge passively. Events obtained in both ways will be stored on the event bus. EventBus is the core concept in EventBridge, which allows you to subscribe to the events, filter the events, and push to the specified target by creating the event rule. The event on the event bus is stored by rocketmq. Through rocketmq-connect, we can pull the event from the register source to the event bus, or push the events from the event bus to the registered target.

image

The code architecture of EventBridge include 4 core modules:

  • adapter Adapt to different operating environments
    • persistence Implement the repository API in the domain layer and persist the model data.
    • api The open API provided by EventBridge.
    • rpc Implement the rpc API in the domain layer to adapter the run environment.
  • common The common code of all modules.
  • domain The core code of EventBridge.
    • model:The core properties and behaviors of model on EventBridge.
    • service: The domain services which across multiple domains.
  • start

Quick Start

RocketMQ EventBridge rely on a message service to store the event, and needs one connect service to collect or forward events.Here, we choose the Apache RocketMQ as our message service, and choose the Apache RocketMQ Connect as our connect service.Of course, you can also choose other alternative services. Eventbridge do not limit it. You only need to provide the relevant adapter API implementation.

Apache RocketMQ

Apache RocketMQ is a great messaging service,and we choose it as our message service.You can deploy the apache rocketmq according to the manual: RocketMQ Quick Start

Apache RocketMQ Connect

Apache RocketMQ Connect can connect the external upstream and downstream services,and You can deploy it according to the manual: RocketMQ Connect Quick Start . Before deploy the Apache RocketMQ Connect, you should download the plugins below and put it to the "pluginpath" which defined on rocketmq-connect.

Apache RocketMQ EventBridge

Before run the project,configure the following properties which :

# The config of mysql databse.
spring.datasource.url=jdbc:mysql://xxxx:3306/xxxx?characterEncoding=utf8
spring.datasource.username=xxx
spring.datasource.password=xxxx

# The endpoint of rocketmq nameserver.
rocketmq.namesrvAddr=xxxxx:9876

# The cluster name of rocketmq.
rocketmq.cluster.name=DefaultCluster
runtime.pluginpath=xxxx

Config the runtime.pluginpath to set the directory of plugin.

Demo

  • Put Events to EventBus The system creates a demo bus by default, and you can send events directly to the bus.
curl  -X POST http://127.0.0.1:7001/putEvents  \
-H "Content-Type: application/json; charset=UTF-8"  \
-H "ce-specversion:1.0"  \
-H "ce-type:com.github.pull_request.opened"  \
-H "ce-source:https://github.com/cloudevents/spec/pull"  \
-H "ce-subject:demo"  \
-H "ce-id:1234-1234-1234"  \
-H "ce-datacontenttype:application/json"  \
-H "ce-time:2018-04-05T17:31:00Z"  \
-H "ce-eventbusname:demo-bus"  \
-d 'A test event.'
  • Check if the local file received a write event

In addition, by default, the system will create a demo rule for you to subscribe and push to the file. You can check whether there are events received in the directory:~/demo

root % tail -f ~/demo
A test event.
A test event.
A test event.

Why does the file output the data attribute of CloudEvent instead of other attributes?This is because the configuration in the demo rule is to output "$.data" in CloudEvent to the file line. You can refer to this document to configure and modify event targets.

rocketmq-eventbridge's People

Contributors

2011shenlin avatar dependabot[bot] avatar zhaohai666 avatar jashinck avatar zhouxinyu avatar lizhanhui avatar xuesongxs avatar lkmxsxd avatar kaori-seasons avatar duhenglucky avatar yiduwangkai avatar ingdex avatar nasuiyile avatar qiaoxingxing avatar ruanjf avatar supercym avatar

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.