We will use the Publish action to asynchronously invoke a service from the proxy service message flow, without having to wait for the calling service to finish its processing.

For this recipe, we have an external Processing Service, available as a soapUI mock service which takes quite some time to do its processing. The interface in the Processing Service WSDL is defined synchronous. We have a business service Processing which allows us to invoke the external service from a proxy service.

Instead of directly invoking the business service from the Publish proxy service, an additional proxy service Processing is added, which only exposes a one-way interface. By doing that, the Publish proxy service can use a Publish action to invoke the Processing proxy service without having to wait for external service to complete.

Let's implement the Publish proxy service, which will use the Publish action to invoke the Processing proxy service. In Eclipse OEPE, perform the following steps:

1. Create a new proxy service in the proxy folder and name it Publish.

2. On the General tab select Any XML Service for the Service Type option.

3. Navigate to the Message Flow tab.

4. Insert a Pipeline Pair node and name it PublishPipelinePair.

 5. Insert a Stage node into the Request Pipeline and name it PublishStage.

6. Insert a Publish action into the Stage.

7. On the Properties tab of the Publish action, click Browse.

 8. Select the Processing proxy service inside the proxy folder and click OK.

9. Insert a Log action after the Publish action.

10. On the Properties tab of the Log action, click <Expression> and enter 'Publish completed, continue with processing in Publish proxy service' into the Expression field.

11. Click OK.

12. Select Warning from the Severity drop-down listbox.

13. Deploy the project to the OSB server.

Now, let's test OSB project by performing the following steps in the Service Bus console:

14. In the Project Explorer navigate to proxy folder inside the using-publish-to-asyncinvoke- service project.

15. Click on the Launch Test Console icon of the Publish proxy service.

16. Leave the Payload field empty and directly click Execute.

17. The output of the Log action from the Publish proxy service should be shown first in the Service Bus console window, followed a few seconds later by the output of the Log action from the Processing proxy service, which is shown after the external service has completed its work.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

About This Site

Howdy! My name is Suersh Rohan and I am the developer and maintainer of this blog. It mainly consists of my thoughts and opinions on the technologies I learn,use and develop with.
Powered by Blogger.

- Copyright © My Code Snapshots -Metrominimalist- Powered by Blogger - Designed by Suresh Rohan -