Get pending events number webmethods 10.5

Hello,

i’m new to the webMethods 10.5 version and i’m trying to migrate a java service that returned in 9.12 version the number of pending events of a channel this way :

        nChannelAttributes channelAttributes =new nChannelAttributes(channelName);		
		nChannel channel = mySession.findChannel(channelAttributes);				
		channelNamedObject = channel.getNamedObjects()[0].getName();
		nbPendingEvents = channel.getLastEID()- channel.getNamedObjects()[0].getEID();

Since getNamedObjects is deprecated 9.12+, i used DurableManager.getAll() like this :

 nChannelAttributes channelAttributes =new nChannelAttributes(channelName);
			
			nChannel channel = mySession.findChannel(channelAttributes);
			
			nDurableManager durableManager = channel.getDurableManager();
			
			channelNamedObject = durableManager.getAll()[0].getName();
			
			// nbPendingEvents = channel.getLastEID()- durableManager.getAll()[0].getEID();
			nbPendingEvents = channel.getEventCount();

the problem is that returns always 0 for nbPendingEvents. By the way, I am not sure I understand the notion of Durables and shared Durables.

Every hint or redirection to the right documentation are welcome !

Thank you

Hi,

Please check the doc link Overview of Durable Subscriptions (softwareag.com) which will explain about Durable subscription in UM and different types of durable subscriptions.

And regarding to the question related to pending events on the channel, Are you looking for the no of events which are not yet consumed from the named object (which is called as durable in 10.5)? If yes, did you try getOutstandingEvents() call.

" nbPendingEvents = channel.getLastEID()- durableManager.getAll()[0].getEID();" - is this call returning 0 always?

Please let me know.

Regards,
Anil

Hi,

In case you are looking for number of events on the channel you can use the following API.

/**

  • Gets the number of events on this channel
  • @return a long specifying the number of events on this channel
  • @throws nChannelNotFoundException the n channel not found exception
  • @throws nSecurityException the n security exception
  • @throws nSessionNotConnectedException the n session not connected exception
  • @throws nRequestTimedOutException the n request timed out exception
  • @throws nSessionPausedException the n session paused exception
  • @throws nUnexpectedResponseException Received a response from the server for which we can not deal with,
  • see the message for further information. One condition of this is if this object has been invalidated and no
    
  • longer
    
  • can be utilised, this can occur if a delete request has been issued to the connected server.
    

*/
public long getEventCount() throws
nChannelNotFoundException,
nSecurityException,
nSessionNotConnectedException,
nRequestTimedOutException,
nSessionPausedException,
nUnexpectedResponseException {
checkIllegalStateUnexpected();
return getBaseChannel().getEventCount();
}

Also number of outstanding event per durable can be obtain from following API

/**

  • Returns the number of outstanding events to be consumed for this durable object.
  • @return number of outstanding events
  • @since 9.12
    */
    public long getOutstandingEvents() {
    return myLength;
    }

Having said that, previous code logic does not either give outstanding event on durable or current no of event and can be simplified in the latest release.

Regards,
Piyush

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.