Search This Blog

Monday, November 28, 2016

Handling Time zone in your SOA/BPM architecture.

WHAT?


Need of handling Time zone correctly in your SOA/BPM architecture.


WHY?


There can be many reasons why this problem needs to be addressed before it comes back as a serious Production defect. Few of the commonly occurring situations are like you need to perform manipulations on the date times in your application and you might need to consider Leap months OR your applications are distributed across different geographical location e.g. End users using GUI in APAC region and SOA/BPM Stack is in Europe and Backend/Legacy application based in America OR more important your application needs to cater for Winter/Summer time zone changes in case of daylight savings OR many known/unknown reasons. There can endless scenarios happen when you deal with date time in your application stack.


Also using correct time zone offset doesn’t solves the all problems completely as in many cases time zone offset is changed based on geographic condition. Hence for sure it makes sense to use open source libraries which hides all this complexities and provides APIs for Developers so that they can focus on building robust application.

If you are still not convinced that using 3rd party library for dealing with date times is a good option then this video is recommended for you 


HOW?


When talking about application development using TIBCO Products based on the Industry experience following approach is recommended however for the implementation in other technology is also more or less same.
  1. Your application will need to invoke APIs of Joda-Time http://www.joda.org/joda-time/ in your BW, BPM implementation, hence you will need to integrate Joda-Time libraries inside your BW Application.
  2. There are many ways one can integrate Joda-Time libraries in the code below is an example for beginners.
  3. When your application is dealing with timestamp in case of :
    • Creating new server timestamp, this will give you correct timezone based on the date e.g. in case your code want  to know timezone offset for the date in summer when it gets executed in winter. 
    • Comparing, Manipulating timestamps in the different timezone.

        

Integrating Joda-Time in TIBCO BusinessWorks:

  1. Include the jars in the Alias Library.
  2. Use Java Code Activity to translate the date time to correct target timezone. Now here you can make the code more intelligent to handle it correctly and you can use different APIs given by Joda.

Integrating Joda-Time in TIBCO AMX BPM:


There are more options available in AMX BPM. For beginners they can expose the functionality which was created in BusinessWorks and can expose them as a web service to use in a AMX BPM or they can expose the same java code in AMX BPM as a service or even using AMX Mediation Component a virtualized service can be created. The new versions of tpcl that comes shipped along with TIBCO BusinessStudio already contains Joda library.

Note: In case if you are intrested in actual sample implementation or you have a problem implementing or even you feel there is better approach for the beginners then it would be helpful if you can drop a message. We strongly believe that collaboration makes internet better place.

2 comments:

  1. Many thanks for the Blog, I did the BW implementation, however during runtime I am facing error as below:

    Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "13-Feb-2015 03:14:32 CET" is malformed at "CET"
    at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:683)

    ReplyDelete
    Replies
    1. One approach to fix this error is you need to pass the java DateTime object, which is already parsed using SimpleDateFormat.

      Also your comment do not provide sufficient details to provide exact cause of problem, can you please write me an error with JAVA source code

      Delete