Chapter 18. HowTo - First steps with the OpenEngSB (Send mails via the OpenEngSB)

18.1. Goal

This section describes a "hello world" use-case for the notification domain using the email connector.

18.2. Time to Complete

If you are already familiar with setting up services in OpenEngSB about 15 minutes. (see HowTo: Setup

18.3. Prerequisites

This HowTo assumes you have already a running instance of the OpenEngSB.

18.4. Creating E-Mail Services

Create a new Email Notification Service by clicking the "New..." link for the Email Notification on the Test Client link.

test client

In the following view you have the possibility to configure the Notification Service. The following screen provides an example for a Gmail account. Please use "test1" for the Service Id field.

email notification

When you have finished setting all fields to appropriate values, create the new instance by clicking the "Save" button.

Now create another service with the Service Id "test2". Otherwise you can use exactly the same values again.

You can validate the services open the "Services" page, which should look similar to the following screenshot. All your created services should be available with the state "ONLINE".

overview

18.5. Executing Service Actions Directly

Now we're going to validate the created services. First of all start by open the "Test Client" link. Now open the "Notification Domain" tree and choose test1. Next get the notify method from the drop down box. The available fields should change instantly. Let the attachment field free and enter anything into message and subject. The address should be a valid email address (not validated for the moment). After all the view should look similar to the following image:

notification properties

Call the service by using the "Call" button. Some seconds after you've pressed the call button the following message should occur on on your screen:

success

Within the next seconds to minutes the address, specified by you, should receive a mail.

Next validate if the service test2 does the same. Therefore press on test2, choose notify again and enter your values. Click "Call" again and validate if you receive an email.

18.6. Executing Service Actions via Domains

Till now you've used the services directly. Now one of the OpenEngSB core concepts is presented: the Domains:

To send messages via domains, instead of directly via the connectors a default receiver for a specific project has to be set. A graphical user interface for doing so is the "Context Page":

context

Change the entry "domains/NotificationDomain/defaultConnector/id" to test1 or test2. Do this by clicking on the node (id). This should create a drop down box next to it. Select test1 or test2. Afterwards go back to the "Test Client" page and select "Notification Domain/domains.notification". Now choose the notify method again and try sending a message to yourself.

Again, the call was successful if you receive a message (with the prefix of the notifier you've chosen in the context).

Congratulations, you have just finished the first implementation HowTo of Open Engineering Service Bus.

18.7. Next Steps

Now that you've finished the most easy OpenEngSB use case go on with a more complex one: Events