Shuttle ESB (iv)-Announcement subscription Model example Introduction (1)

Source: Internet
Author: User
Tags msmq

Earlier, I've focused on three articles to talk about shuttle ESB's Getting started example and macro concepts.

The Shuttle ESB has two modes of sending messages together: request/Correspondence mode and Pub/sub mode.


About the distinction between the two patterns. Take a look at the following article:Shuttle ESB (iii)--Architecture Model Introduction (2)


In the first article of the shuttle ESB, the introduction to the Getting Started instance is a request-response pattern based on command commands. Such a pattern sends a simpler message. is synchronous.

There is a greater coupling between the sending message end and the receiving message end.

After the request is sent, the other processes are in a wait state. The client does not perform any other behavior until the service side returns the response information.


The command and Pub/sub modes of the Ps:shuttle ESB are all similar to the peer and Pub/sub in EJBs.


However, the Pub/sub mode fully decouples the advertised end of the message from the Subscriber.

The pub side sends a message without waiting for the message to return, and it can choose to continue sending or stop sending.

The receiving side false assumption receives the message. Just subscribe to the event message.

When we actually use the shuttle ESB in the project. In most cases, we will use the Pub/sub mode. Following. We will explain this pattern.


Note: Even a command-based request/correspondence pattern can be implemented in a way that publishes subscriptions.


For now, the Shuttle ESB only supports three types of queues: Microsoft Message Queuing MSMQ, SQL Server table-based queue, and rabbit MSMQ.

The pub/sub mode of the Shuttle ESB requires MSMQ and SQL Server to be implemented based on the two message queues of the table queue.


With regard to SQL Server table queues, we may have doubts: does using SQL Server database limit the scope of the shuttle ESB?

You don't have to worry about it.

Shuttle ESB core components are not based on whatever third-party components. It will certainly support MySQL and Oracle or other databases in the future. For now, just because Eben has not used Oracle, it is not very familiar to Oracle. So there is no Oracle-based queue implementation. Of course he told me many times. I want to make a contribution to the open source community. Give him some code on GitHub. But this implementation is not the same thing two days a day. I really don't have time to study now. This time is more urgent. I have to think about livelihood.

Have to survive first. Think about making a contribution. After a year to say it.


To go back, we continue to introduce the demo implementation based on the PUB/SUB model. Features are very easy:

Publish a message Event ordercompletedevent from the message Publishing side pub, and multiple clients (such as Suba and Subb) subscribe to the event ordercompletedevent.

Then when pub publishes the message, Suba and Subb receive the message ordercompletedevent.

Suba and Subb received the message, according to the need for a certain treatment.

Then they will publish a Workdoneevent event message. This service-side subscription workdoneevent message.

When Suba and Subb announce the workdoneevent message. The pub side will be on the line to receive the message workdoneevent.


PS: Why does the announcement end of the message and the Subscriber use two different messages? Given the assumption that the same message is used. The above implementation will form a dead loop.

The reason is that after the shuttle ESB instance is started, the instance listens to one or more given message queues, assuming that the advertisement side and the Subscriber listen to a queue, forming a dead loop.


Here are some examples of how to prepare for your development


1, install Microsoft elimination of the interest queue: MSMQ

For detailed installation please see:Shuttle ESB (i): Getting Started instance


2. Create a database and initialize the database table queue

Create a database in SQL Server: Shuttle (you can define your own database name). Then execute the "{root}\shuttle.esb\source\shuttle.esb.sqlserver\scripts\subscriptionmanagercreate.sql" script (in the source code.) The script is provided in this sample) to create and initialize SQL Server table queues.


3. Installing the NuGet Plugin

It is a plug-in that manages third-party DLLs.

About the installation, use of NuGet, there are a lot of online, I do not specifically introduced here. Everyone's own Baidu can.



Concrete examples, the next article continues to introduce.

Shuttle ESB (iv)-Announcement subscription Model example Introduction (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.