Creating an OnStartup / OnShutdown process in TIBCO BW 6

If you are a developer that are migrating from TIBCO BW 5 to TIBCO BW 6 and you have been working a bit with the new tools, you are probably aware that you don’t have a onStartup or onShutdown starter process like you have on your TIBCO BW 5 Designer. So, is it posible to have a process that execute when the application is starting or have we lost a useful feature? No, don’t worry my friend. You keep your same features but you have to do it using a different approach, but you are going to have the same functionality. Do you want to see it? Ok, let’s go for it!

To do that, we need to go first to our Module descriptor and on the overview panel you are going to find a “Activator Process” field like you can see here:

TIBCOBusinessStudio_2016-02-18_21-43-06

Using this button with the engine icon we can create an Activator Process, if we do that, we are going to have something like this:

TIBCOBusinessStudio_2016-02-18_21-46-25

And there we have a Process Activator with two operations. One for the onStartup procedure and the other for the onShutdown procedure. So here it’s all the things you are used to. You have to implement the operations. In this case, we are only adding a Log Activity to test the right behavior. So, the final process looks like this:

TIBCOBusinessStudio_2016-02-18_21-58-57

And now, if we run the process, we get the following stdout logs:

TIBCOBusinessStudio_2016-02-18_22-02-30

So, as you can see we are executing the onStartup process right before the application is started. That’s the main different between this approach and to use a normal BusinessWorks process with a Timer (once invocation)  starter. The onStartup executes before the application is started and the Timer executes after the application is Started. The same thing happens with the onShutdown.

As usual, you can fing the source code from this sample in our GitHub repo: Download!

Advertisements

2 thoughts on “Creating an OnStartup / OnShutdown process in TIBCO BW 6

  1. Hi Alex,

    Thank You for the write up on activator process. It was informative.

    I tried to include a call process withing the OnStartUp constructor and the application threw a null pointer exception when the process thread passed on to the sub process.
    So, I ended up wrapping the sub process in a service and then invoked it from the OnStartUp service constructor. This works. However, I was wondering if there was a better way of doing it.

    Please advise.

  2. Can you please explain:-
    A) How are you going to test on Shutdown scenario ?
    B) How to print the log added in on Shutdown?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s