STP/EID Component/YourFirstEidProject

From Eclipsepedia

Jump to: navigation, search


Your first Enterprise Integration Designer Diagram

At this point you have got the Ganymede update that contains the plugins you need to get started. As of version 0.8.0, the EID allows you to draw Enterprise Integration Pattern diagrams, then produce configuration for the ServiceMix and Petals ESBs, or any other software that repackages these ESBs.

Create a Project

With EID, you are just going to create a diagram and configuration, so you don't really need a Java project. If you want to construct bean adapters, or other extensions, then you will need to use a Java project. For this example, you will create a plain ol' Eclipse project using File > New > Project... and then selecting the General > Project wizard. Call this project patterns.

Create a New Diagram

Next step, right-click on your patterns project and choose New > Other... from the context menu, then select the Cimero > Cimero diagram wizard. The code for the integration designer was originally called Cimero, so you will see the odd reference to it here and there.

STP EID DiagramWizard.png

The wizard will ask you what ESB do you wish to use (we hope to have more choices as we go on, or change the architecture a bit). For this example, choose ServiceMix

STP EID ChooseESB.png

Then press Next

Next step is to assign a name to the new diagram file that you are going to create.

File:STP EID Name.png

Then press Finish. The EIP diagram editor will appear.

STP EID Diagram.png

Create a New Pattern Assembly

Ok, so now you are ready to go join EI patterns together. As you can see from the palette, there is a limited number of EIPs currently available. We'll grow this default set as time goes on, and we will make sure that there is a proper contribution architecture in place for them. Right now you do have the capability to add extra things to the palette, but that will be treated in a separate HOWTO. For now, we are just going to create a simple assembly of Enterprise Integration Patterns.

To put a pattern on the canvas, select one in the palette, then mouse over and click the canvas. Try it with a wire-tap and a content-based-router.

STP EID wtcbr.png

You've probably noticed that the palette and canvas don't implement drag-and-drop yet. Patches are welcome! :)

Rather than clutter this page with screenshots, I'm going to do two steps now. First one is to see how you can connect the two little green Gregorgrams you've just put on the canvas. Up at the top of the palette, there is a graphic of an arrow and the word Connection. Select that arrow, then mouse over to the wire-tap. Click on the wire-tap, and keeping the mouse button down, mouse over to the content-based-router and release the mouse button. This will make a connection between those two patterns. No picture yet, our next step is to put in a very important part of an integration solution - the *endpoints*. These are the sources and sinks for data in the integration.

Scroll down to the bottom of the palette. There you will see five *white* icons. They are not standard EIP icons, but instead represent endpoints that live at the edge of the integration. There are a number of different endpoint types, but for now we're not going to worry too much about each one. Take one HTTP endpoint and two JMS endpoints and connect them like so:

STP EID Assembly.png

Nice! You've made your first EIP diagram with this tool. It would be good to be able to put some documentation on the canvas too, and there's a way that you can do that, although it's not obvious. With the mouse, hover over the content-based-router. You will see two small arrows appear below or beside the icon and each arrow will have a little box at the end. These arrows appear but fleetingly, and will disappear unless you can grab one of the boxes. Click on a box to grab it and, keeping the mouse button down, pull it out into the blank space of the canvas. A grey line will follow the mouse pointer, and when you release the mouse button you will get a little menu:

STP EID NotePull.png

If you then select the single option on the menu, you can add a little note that will be connected to the pattern icon, where you can add some text explaining things:

STP EID Note.png

Configure Pattern Properties

Now you have a complete diagram, the next thing is to configure the ESB-specific properties for each pattern. Right-click on the canvas and you will see the context menu below. Select Show Properties view from this menu.
STP EID GenerateMenu.png
<p>The properties view shows the properties that are associated with the EIP that is currently under the selection. Here's an example of what's there for the content-based-router you put on the canvas earlier.

STP EID cbrprop.png

The key thing to point out here is that we chose the ServiceMix ESB at the start of this procedure, and this is a ServiceMix content-based-router property sheet. The little red, blue and green icons that you see in the property sheet are explained in the online help - just select Help > Help Contents and you will see a section dedicated to the EID, although it's still called Cimero :)

STP EID Help.png

Generating Configuration

I'm taking a bit of a step here, and making an assumption that you already know how to configure ServiceMix. I apologise - and promise to backfill at a later time - but for now, I've expected that you have clicked on every item on the canvas (two Gregorgrams, three endpoints) and added appropriate properties that you have sussed out from your hard-won ServiceMix knowledge.

You should also have spotted the bug in the diagram - the wire-tap should have at least one output connected to an endpoint, but it's not here in this picture. I've fixed it by adding a new JMS endpoint:

STP EID wtok.png

Ok, back to generation. Previously, when you brought up the properties view, you used the canvas' context menu. Also on that menu you will see some configuration generation options, specifically Generate JBI Package and Generate ANT Task and JBI Descriptors. Once you have configured all of the properties of the patterns that have been used, you can choose one of these options and have (in this case) ServiceMix configuration generated. Do this now, and check the patterns project to see what has been produced