Wednesday, August 13, 2014

Create Service Bus Customization File using WLST

For one of our Oracle Fusion Middleware projects we had the requirement that the IT Ops activities should be scripted as much as possible. These activities included things like packaging, deploying, and automated testing of Service Bus projects, SOA Composites, and BPM processes. One of the more challenging tasks to script was to create and extract the runtime configuration of services deployed on Oracle Service Bus 11g using customization files. There seems to be no WLST feature readily available for this purpose. Based on some resources that all contained part of the solution, we were able to construct a WLST script for this purpose which you can find in this blog.

This blog briefly explains the use of customization files, how to create a customization file using the Service Bus Console, includes the WLST script to execute this task, and provides a brief conclusion.

Customization Files

Customization files are XML files that contain the configuration of Service Bus resources and projects. Examples of such configurations are Service URIs, JCA settings, Retry Settings, and so on. Customization files provide a convenient way to apply environment-specific configuration during deployment. You can both apply, as well as create and extract the runtime configuration of Service Bus resources and projects into customization files using the Service Bus Console.

Creating customization file using the Service Bus Console

Read more about customization files in the Oracle Fusion Middleware Administrator's Guide for Oracle Service Bus.

WLST Script

Based on the following resources a WLST script can be created to export an OSB project including its customization file from a runtime environment:


The WLST script is as follows:

from java.io import FileOutputStream
from java.util import Collections

from com.bea.wli.config import Ref
from com.bea.wli.config.mbeans import ConfigMBean 
from com.bea.wli.sb.util import EnvValueTypes

import sys

#==================================================
# Utility function to export project and cust file
#==================================================
def exportProject():
    try:

        if projectName == "None":
            print "No project specified, exiting deployment"
            exit(exitcode=-1)

        if customizationFile == "None":
            print "No customization file specified, exiting"
            exit(exitcode=-1)

        ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfigurationMBean found"
        
        configMBean = JMX.newMBeanProxy(mbs, ObjectName.getInstance("com.bea:Name=Config.XBus Kernel,Type=com.bea.wli.config.mbeans.ConfigMBean"), ConfigMBean)
        print "ConfigMBean found"

        # Get reference to OSB project        
        ref = Ref.makeProjectRef(projectName);
        collection = Collections.singleton(ref)
        
        # Export OSB project JAR            
        print "Export JAR for OSB project:", projectName
        
        theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)
        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        
        print "Project " + projectName + " exported"

        # Export OSB customization file
        print "Export customization file for:", projectName
        
        theBytes = configMBean.createCustomizationFile(collection, EnvValueTypes.ENV_VALUE_TYPES);
        out = FileOutputStream(customizationFile);
        out.write(theBytes);
        out.close();
                        
        print "Cust file for " + projectName + " exported"
    except:
        raise

try:
    
    adminUser         = sys.argv[1]  
    adminPassword     = sys.argv[2]  
    adminUrl          = sys.argv[3]   
    projectName       = sys.argv[4]
    exportJar         = sys.argv[5]
    customizationFile = sys.argv[6]    
    passphrase        = "your-passphrase"
    
    connect(adminUser, adminPassword, adminUrl) 
    domainRuntime()
    exportProject()

except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise

Conclusion

WLST provides a very powerful and comprehensive scripting environment for Oracle Fusion Middleware products. While most administration and management features can be accessed and executed through WLST, some of the features that are available through IDEs or consoles are not (easily) available through WLST and require a workaround or some research. One of these examples was shown in this blog.

Monday, July 14, 2014

Oracle BPM Suite 12c and SOA Suite 12c at eProseed World 2014

As most of you know, Oracle officially released SOA Suite 12c (12.1.3) and BPM Suite 12c (12.1.3) a couple of week ago. Exciting times for people like us, who have worked extensively with BPEL Process Manager, Oracle ESB, SOA Suite 10g, and SOA Suite 11g! The same week that 12c was released, eProseed World 2014 took place. During this event all eProseed employees meet for a fun couple of days full of social and work-related sessions. Because Vennster is merging into the eProseed Netherlands office we will soon migrate this blog to an eProseed domain. For us it was an excellent chance to meet all our new colleagues. In between the tour of Luxembourg city and an afternoon full of Highland Games (nobody got injured :-), multiple sessions where organized to present and discuss Oracle BPM and SOA 12c.



The SOA Suite 12c presentation included an overview of 10 years of Oracle & SOA, new features and important themes in Oracle SOA Suite 12c, and information on the migration tool bundled with SOA Suite 12c to perform in-flight upgrade from 11g to 12c.


Friday, May 16, 2014

To Pull or to Push

In a recent project various designs were discussed to integrate business processes implemented in Oracle BPM with a Java front-end application. More specifically, how status changes in these processes could be communicated to the end user via the front-end. The possible scenarios quickly boiled down to a poll versus push approach and various in-between scenarios. This blog lists the various approaches and design considerations.

Case

The custom-built Java application provides a thin and stateless User Interface that is used by local branch employees to sell products to customers. The process of selling these products is coordinated through a business process that is implemented in Oracle BPM 11g. The configuration of the products for a particular customer is done by the employee through the Java application. After the configuration of the product is completed, the Java application sends a signal to the process. The process will initiate various automated tasks such as credit checking. In the meantime the employee waits until these tasks are executed, then views the results of those checks and continues with the completion of the order.

The question we discussed is how to inform the employee, though the Java application, that the checks are executed by the process and the employee can move on. We know the milestone in the process is reached through a combination of the occurrence of a particular Human Task and the process state itself.

Solution based on polling

In a polling approach, the Java front-end application polls for the process status and workflow status every few seconds using the out-of-the-box Oracle BPM and Human Workflow APIs. The client applications poll to see if process instances have reached a particular milestone; if so the application moves forward. Since the Java application is stateless and has no server side, the custom application directly polls from every client session and not from a central web server. This means every new client will increase the load on the BPM platform. Stress tests showed that in this scenario the OBPM engine would be mostly busy handling polling requests and couldn’t accommodate for a high degree of concurrently running process instances.

The basic polling approach is simple to implement from the perspective of the Java front-end, but not very scalable.

We could consider optimizing the polling. For example to use a Coherence Grid or Service Bus Result Cache as caching layer between the Java clients and the Oracle BPM APIs and have the clients poll the cache instead of the APIs directly. Upside is that such a cache is easily created and that we limit the number of requests on the backend BPM engine by centralizing the polling requests and using a default caching mechanism. Downside is that the polling results can be outdated when the actual process state has changed and the process status data in the cache is not yet invalidated.

Solution based on pushing

The Java front-end clients are interested in some status change. For this purpose, a natural approach would be to push an event from the process to the Java clients when that particular milestone is reached. The preferred choice in this scenario would be to use JMS for this since this standard is both supported by Java as well as Oracle BPM 11g through the use of JCA Adapters. The pro of this approach is that it is much more scalable. We only perform an activity (publish an event) when needed, we don’t do useless polling. Downside however in this case is that the front-end application doesn’t support event subscription using JMS and this would require a significant change in that application.

Approach

We used a three step approach:

  • Short-term. Expose a new service that encapsulates the polling logic. Implement this service on the Service Bus and use Result Caching to cache the polling results. This service is easily created and alleviates the back-end usage of OBPM APIs. The business needs to accept that results can be outdated in some scenarios as a trade-off for the increased load that can be supported.
  • Middle-term. Push events from the BPM process using Mediator and a JCA JMS Adapter when a certain milestone is reached and store the event data in a custom table. Have the Java front-end poll on the custom table. In this approach the process uses events, which is the desired approach. We only need a small change to the Java front-end to poll on the custom table instead of the OBPM engine itself, thereby offloading the engine. The Java front-end however still incurs overhead by using a polling approach. 
  • Long-term. Change the custom Java application to support event subscription, for example using JMS. This way the scalability of the front-end application will improve since the number of events is much lower than the number of polling requests. Also, on average the front-end application knows about reaching the milestone faster using events, than it does when periodically polling for that information. 


Tuesday, March 18, 2014

Oracle User Messaging Service: Implementing custom messaging channels

Oracle User Messaging Service or UMS enables two-way communication between applications and users. There is support for a variety of messaging channels like email, IM, SMS and voice. Another option is to deliver messages to a user’s work list.

With UMS messaging preferences users can define how and when they want to receive message notifications. They can define filter criteria to only receive messages they are interested in. Applications can send messages to a user respecting their preferences or send messages over a specific channel.

In addition to the default channels, organisations can define custom channels using the Messaging Extension Driver. Messages for such channels are then delivered to a web service listener endpoint. This web service implements the actual delivery of the notification for that specific channel.

In this blog I’ll show the steps needed to send messages through a custom channel: 1) Implementing the Message Notify Service interface 2) Configuring the Messaging Extension Driver 3) Adding the channel to your user's message channels 4) Sending messages

Implementing the Message Notify Service interface

To be able to use the web service in the Messaging Extension Driver of UMS it should implement the Messaging Notify Service WSDL. The content of this WSDL is listed in the Admin guide here.


To quickly implement the service Message Notify Service interface I created a SOA composite that puts the contents of the notification message in a file using the File Adapter as illustrated above.

Configuring the Message Extension Driver

By default an instance of the usermessagingdriver-extension application is deployed but not targeted to any servers. To enable the driver, use the Administration Console to target it to the servers where UMS is running.

To configure the driver navigate to the usermessagingserver home page in the Enterprise ManagerClick User Messaging Service > Driver PropertiesSelect and Edit the driver usermessagingdriver-extension.





Under Driver-Specific Configuration, add a new extension endpoint configuration group and specify the correct properties:
  • Group: CUSTOM
  • Endpoint URLhttp://localhost:8001/soa-infra/services/default/MessageNotifyService/MessageNotifyService
  • Protocol: CUSTOM
Click OK to save the configuration.

Adding the channel to your user's message channels

To be able to receive messages over the custom channel, it must be added to your user’s messaging channels using the UMS preferences UI.

Login at http://localhost:8001/sdpmessaging/userprefs-ui with your user credentials and create a new messaging channel with the following properties:
  • Name: My custom channel
  • Type: CUSTOM
  • Address: nico
  • Set a default channel: true
The address is your unique user address for the custom channel similar to your email address. By setting the default property the channel will also be used to deliver messages that were sent to you based on user preferences.


Notice the warning at the bottom of the popup. The Notification Service used by the BPEL User Notification activity and Human Workflow is based on UMS. Unfortunately this service only supports the default channels where the user's channel address like email or phone number is fixed to the information stored in the identity management system.

Sending messages

To send messages with support for all channels UMS we have to use UMS directly using one of the  multiple UMS APIs. These include an EJB API, a plain Java API and a Web Service API . In this example we will use the Web Service API as documented here.

In JDeveloper create a new Java project and add the following libraries:
  • Web Service Data Control
  • BC4J Security
  •  JAX-RPC Client
and add the following JAR files:
  • sdpmessagingclient.jar
  •  sdpmessagingcommon.jar
  •  Oracle.http_client_11.1.1.jar
  • Oracle.logging-utils_11.1.1.jar

Create a new instance of the messaging client using the following code snippet:

HashMap<String, Object> config = new HashMap<String, Object>();
 
config.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8001/ucs/messaging/webservice");      
config.put(ClientConstants.POLICIES, new String[]{});
config.put(SecurityConstants.Config.CLIENT_CREDS_LOCATION,
  SecurityConstants.Config.CLIENT_CREDS_LOC_SUBJECT);
config.put(MessagingConstants.APPLICATION_NAME,"usermessagingsample-ws");

MessagingClient mClient = new MessagingClient(config); 

And send a message to a user using the custom channel:
       
Message message = MessagingFactory.createTextMessage("You received a message");
message.setSubject("Message over custom channel");
message.getRecipients().add(MessagingFactory.createAddress("CUSTOM:nico"));
mClient.send(message, null,null);

That's it! There should be a new instance of your Message Notify Service composite delivering the message to a file on your server.

To send a message to a user based on his preferences set the address as following:

message.getRecipients().add(MessagingFactory.createAddress("USER:nico"));

Now not only the custom channel is used to deliver the message but also the other channels marked as default like the email channel for example.

Thursday, February 13, 2014

Experiencing Interaction '14




Interaction '14 logoLast week I visited Interaction ’14 which was held in Amsterdam. Interaction is the annual interaction design conference built around a global community. As User Experience Expert I attended several Computer Human Interaction conferences before, but never this one. And I must say it was a very inspirational experience.

Context influences perception
One of the key takeaways was that context influences perception. This was shown in the talk by Bernard Lahousse (Partner at Foodpairing.com). He stated that the perception of food changes by the context in which it is served. To prove this, he asked a volunteer on stage and let him rub a rough object and simultaneously taste a drink, a minute later this subject had to taste another drink while rubbing a soft stuffed animal. The subject stated that the 1st drink tasted sharp/bitter and the 2nd drink more creamy/sweet. In fact he drank the same drink twice. So a tactile context influences perception of food.
The same goes for a bottle of wine you take home with you after a great holiday in Greece, because it tasted so well in a Greek tavern after a day of sunshine in Mediterranean air. Drinking the wine at home on a drizzling Saturday evening is perceived totally different.

The message of this talk matches very well with the talk by By Thomas K├╝ber (Design lead at Groupon) and Christian Drehkopf (User Experience Evangelist and Mentor) in which they stated that we, as interaction designers, should not design for devices but “we should deliver experiences that create superb value for the users in their personal situation/context”.

Design motivation and curiosity
In order to inspire users to use the applications or products we design, we have to motivate users and make them curious. At Interaction ’14 there were 2 talks which gave some insight in how to do this.

There was Ellis Bartholomeus (Game- & Design consultant). She explained that motivation can be designed via play. To play you need a game (= the definition of the rules and goals) and a player (= the person interacting). To motivate the player to play the game, the player needs to feel safe and trust the game. The game should be hard to play, but not too hard. If the player barely completed the level, he will be curious about himself in the next level and be very loyal to play it again. A player will be motivated by a game if it contains wonderment, engagement, frustration, reward, surprise, irritation, freedom competence and joy.

Jan Willem Huisman (founder of IJsfontein Interactive Media) talked about how “curiosity and playfulness are deeply embedded in our mind and feed the urge for learning and exploring”. Users need structure, and must always feel in control.  By nature users also are curious and motivated and these characteristics should be fed by the applications/product they use. Curiosity is the urge to fill the information gap and curiosity can be designed among others by:
  • leaving room for experiments
  • telling what to expect and then hiding it
  • creating violation of expectations
  • creating a sequence with an unknown ending
  • introducing novelty
  • introducing information that is possessed by others.
  • creating collaborative curiosity
However, the user should always be in control. “If we take control of the user, we kill curiosity” says Huisman.

Onlyness & Design Loneliness
I attended two talks pleading that good user experience design always involves a team.
Tash Wong (independent product designer) talked about Onlyness by which she means the fact that “we all have our own perspective and own unique feminine or masculine point of view from which we design. We are social engineers that design for behavior and communication.” To be able to design products/applications for others we need empathy and look at things from different points of view. Tash Wong developed a method containing a set of 16 cards which is designed to help UX designers better articulate their perspectives and priorities. The cards can be used to communicate the direction for a project, figure out why we do, what we do, or generate new ideas and then ‘Think Bigger to Make Better’.

Then there was Christopher Noessel (Managing Director at Cooper) talking about Design Loneliness and ‘Pair Design, Why You Need It’. In Agile developing software development pair programming is common. In UX design working in pairs also leads to better results. What you need is a pair of 2 designers: a generator (who generates ideas and sketches) and a synthesizer (who analyses and connects). Co-working like this results in a better design, a more efficient way of working and a happier team. While co-working like this, 3 rules should be taken into account:
1. There can only be one marker in the room
2. Ideas should be visualized, not only talked about
3. Feedback is given (mainly by the synthesizer)
    - What’s good
    - Questions?
    - Suggestions for improvement 

At Vennster we already work like this and from experience I can tell that it works.

Last week I have been listening to many experts in the field of interaction design and I gained a lot of inspiration which I definitely can use in the projects I’m currently working on as a User Experience Consultant for Vennster and in the ones I will be working on in the future.
If you want to read more about the lectures given at Interaction ’14 just visit their site http://interaction14.ixda.org