The Mobile & Digital Assistant Blog covers the latest in mobile and conversational AI development and engagement

My Favorite Features (part 2)

Jeff Davies
Cloud Success Manager

In my last blog entry I showed you two of my favorites features in Service Bus 12c (included in Oracle Mobile Suite 12c and SOA Suite 12c). In this blog, I'll mention another new feature that is very powerful, giving enterprises the ability to create standardized service implementations. This feature is named, "Templating".

What is a template?

A template is a structured Service Bus pipeline. It allows your company to create standard service implementations. The users of these templates can only extend the default functionality along restricted lines. In Java terms, think of a template as an abstract Java class. An abstract class can provide default functionality, but also requires the user of the class to implement the required abstract methods (ie. the extension points).  A "concrete" class is a Java class that extends an abstract class. I borrow that naming standard for the "concrete" pipelines that implement the Pipeline Template.

Lets take a look at how to create a template. From within a Service Bus project, select File / New / Pipeline Template from the main menu. A short wizard will pop up prompting you for the pipeline name and other basic information. When the pipeline template appears in the main editing window in JDeveloper, the first thing you will notice is that the background of the template has a grid that looks like graph paper. This is your visual indicator that you are dealing with a pipeline template, and not a regular pipeline. You can then add the standard nodes and actions or Template Placeholders. Here is an example of a template pipeline that implements standardized logging and error handling:

A pipeline template with standardized logging To the right of the start node you will see an error handler defined for the overall pipeline. This guarantees that any error thrown in the pipeline will be caught by this error handler. This is handy in case the developer that uses this template to create a concrete pipeline forgets to add error handling, or does not implement error handling for a specific error condition. If that happens, the default error handler will catch the error and log it.

Similarly, you can see in the PipelinePair that both the Request Pipeline and the Response Pipeline contain stages with Log actions. These log actions will log the request and response payload for the service. Bear in mind that this is just an example! You can add other actions instead, or log entirely different information. Its all up to you, the template designer. 

So that takes care of the default implementations of the template. Any developer that uses this template for their pipelines will get this behavior by default. But what about extending the pipeline? Simply logging the request and response, along with default error handling is not useful on its own. We need a way to allow the template user to add their own logic. That is what Template Placeholders are for. 

The next screenshot shows the Components palette for the Template Pipeline. Most of the palette will look familiar to experienced Service Bus developers. The new section is the Template Placeholders at the top.

By dragging and dropping these place-holders onto the template, the template designer is specifying where a user of the template may add their custom code. If you look again at figure 1, you will see a total of 3 Stages placeholders (areas where 1 or more Stage nodes can be dropped).

So how do you use a template? Its quite easy. When you create a new Pipeline in Service Bus, the Pipeline creation wizard will have a checkbox asking you if you want to associate a specific template with the pipeline. Check that checkbox and select the template you want to use. When the wizard completes, it will open your pipeline in JDeveloper for editing.

Notice that most of the editing area is greyed-out, indicating that you, the concrete pipeline designer, cannot modify those sections of the pipeline. Only the Stages template placeholders are available to you for customization. In the above screenshot I added a single stage with an Assign action in the Request Pipeline. I could add more stages and actions as needed.

What if I find the template too restrictive?

 Once you have created the concrete pipeline, you have the option of breaking the link between the concrete pipeline and the template. Just right-click on the pipeline and select Service Bus / Break Template Link from the popup menu. Your proxy service can then make changes to ANY part of the pipeline.


 Templating provides your company or development group with additional control for service implementation standardization. It allows service developers to simply inherit important functionality without having to copy/paste between projects and services. Because this is a new feature, you may not have been aware of what it can do for you. Hopefully this blog entry has intrigued you to further explore the use of templates in your projects. 

- Jeff 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.

Recent Content