Before, my focus was on three articles shuttle ESB entry and macro concept paradigm.
Shuttle ESB Pattern: request/Correspondence mode vs. Pub/sub mode.
For the distinction between these two modes, see 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. This mode sends a message that is relatively simple and synchronous. There is a greater coupling between the sending message end and the receiving message end. After the request is sent, the other process waits, waiting for the server to return the response information before the client can perform other actions.
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.
After the pub side sends the message. You do not have to wait for the message to return. 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, most of the time. 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. Shuttle the pub/sub mode of the ESB. MSMQ and SQL Server are required to be implemented based on the two message queues of the table queue.
About SQL Server-based table queues. We all might have doubts: Use SQL Server database. Does it 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 and is not very familiar with Oracle, there is no Oracle-based queue implementation. Of course he told me many times that I wanted to make a contribution to the open source community and give him a little bit of 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 consider the problem of livelihood Ah!
You have to survive and think about contributing!
After a year to say it.
Anyway 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. So when pub publishes the message. Suba and Subb will receive the message ordercompletedevent.
Suba and Subb receive the message. According to the need for 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 end receives 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). 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 and use of NuGet. There are a lot of online, I do not specifically introduced here.
Everyone's own Baidu can.
Specific examples, continue to roll out the next article.
Shuttle ESB (iv)--Announcing the subscription model example (1)