Hi,

Here is a sample from WS GRAM on notification from topics.

http://viewcvs.globus.org/viewcvs.cgi/ws-gram/service/java/source/src/org/gl
obus/exec/service/exec/ManagedExecutableJobResource.java?revision=1.43.2.28&
view=markup&pathrev=globus_4_0_branch

Look at setState() method in the above. To break it down some:


// notify will take any object

Topic stateChangeTopic = new SimpleTopic(<topic Name>);
stateChangeTopic.notify(messageWrapper);

As an example, GRAM has this:

StateChangeNotificationMessageType message
            = new StateChangeNotificationMessageType();
        message.setState(state);
        message.setHolding(holding.booleanValue());
        message.setFault(fault);

        
            message.setExitCode(exitCode.intValue());
        //save the notification for sending to late subscribers

        StateChangeNotificationMessageWrapperType messageWrapper
            = new StateChangeNotificationMessageWrapperType();
        messageWrapper.setStateChangeNotificationMessage(message);

I will write up a simple example and post with documentation by next week.

Rachana


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Xinjun Chen
> Sent: Friday, January 04, 2008 9:21 AM
> To: [email protected]
> Subject: [gt-user] Sample Custom Topic in WS-Notification
> 
> Hi gt users,
> 
> I am using GT4.0.5 Java WS Core in Windows. I have this question in
> mind for quite long regarding WS-Notification.
> 
> I would like to use WS-Notification to do notification. Borja's
> tutorial give an example for ResourcePropertyTopic, but I am wondering
> how do we define a custom topic. I guess we should take advantage of
> SimpleTopic, but is there any standard procedure to define a custom
> topic?
> 
> To make my question concrete, I have a resource property (int load), I
> have another resource property (int maxLoad). I need to notify the
> listener if (load >= maxLoad). How can I define this custom topic and
> do notification?
> 
> A walkaround may be that I define another resource property margin =
> (load - maxLoad), and cast the resource property margin to
> ResourcePropertyTopic. But I don't like this walkaround.
> 
> Can any one point me to some sample? Thanks.
> 
> 
> Regards,
> Xinjun

Reply via email to