<next-event>

Purpose/Function

Pull the next event off of an internal queue created by subscribing to the LocalEventSupport (see <subscribe> ).

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

subscribeId

java.lang.String

(required)

the id under which the event queue has been assigned to the environment

block

boolean

true

non-blocking means the task returns immediately, possibly with a null value for the event

Elements

None.

ReturnValues

DEFAULT NAME

TYPE

nextEvent

ncsa.tools.events.types.events.LocalEvent

NOTES

See also LocalEvent, LocalEventFilter.

Examples

<ogrescript>
   <subscribe subscriberId="worker">
	<filter topic="TROLL">
		<header-comparator>
			<property-comparator comparator="EQUALS">
				<property name="component" value="master"/>
			</property-comparator>
		</header-comparator>
	</filter>
   </subscribe>
   <while condition="$E{true}">
       	<declare name="nextEvent"/>
       	<echo message="waiting for master to signal next iteration ..."/>
        <next-event subscriberId="worker">
       	    <return-value defaultName="nextEvent"/> 
        </next-event>
        <echo message="got event ${nextEvent}"/>
        <declare name="header"/>
        <declare name="current"/>
        <get bean="${nextEvent}" property="header-properties" assign="header"/>
        <get bean="${header$I{iteration}}" property="value" assign="current"/>
        <assign name="current" int="${current}"/>
     	<if>
          <equals firstInt="${current}" secondInt="9"/>
          <echo message="last event ..."/>
          <break/>
        </if>
   </while>
   <unsubscribe subscriberId="worker"/>
</ogrescript>
  • No labels