Can you use the DataAreaListener Interface?

Are you trying to interface with AS400 machines with Java? Are you thinking about using some data area in iSeries and communicate with it by adding a listener to it?

Yes, the IBM toolbox provides the DataAreaListener, right for that purpose – to listen to events occurring on a data area in iSeries machine. But, hold on! Can you really implement this interface for the purpose specified?

What is not mentioned in their documentation is that, you can use this interface to listen to events like create, delete, clear, write, read created ONLY THROUGH JAVA. So, you can’t use this listener for listening to the same events occurring/created by any other means!! (like manual changes or some SP changes or whatever!)

I spent few hours in implementing this interface to listen to manual changes occurring in the data area. Then when I was testing, I discovered that my listener is not working at all! After few hours of debugging and searching on net, I figured out that this listener can listen only to changes made through java code. (I tested and found the listener working when I made some changes through java code. So, my listener implementation was indeed fine.)

Anyways, with very little effort, I changed my listener implementation to poll and check for the changes on its own every minute by extending java.lang.Thread class.

It does make perfect sense that a listener implemented in Java can listen to only changes made through java. However, I still feel that they should include this information in the documentation as well! Else, it can be very misleading!

DataAreaListener

Advertisements

One comment

  1. Hi you saved me a lot time. Thank you! 🙂
    (Can you use the DataAreaListener Interface)

    I live in Switzerland and liked your blog on the falls.

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

%d bloggers like this: