Implementing Counter


Could any of you give a hint on how to implement a counter in webMethods? in the sense, assume there is a flow service that is being triggered by a document. how can we find the number of times that the service got triggered. In our design, we got to use that service count and develop further logic.

Thanks for all suggestions.

you can use the wm.server.query:getServiceStats, it will return a document list with all the services that have executed. the “name” and “sAccessTotal” fields are the ones you want. Good day.

Yemi Bedu


Let’s go with the assumption that the incoming docs have a unique identifier(DocumentID).create a table with 2 columns(DocumentID and counter i.e number of times it has been processed).when a document arrives,extract the documentID.if the document processing is successful,add a row in the table with the DocumentId and a counter of 1.when the second time the same document arrives,check for the documentID in this table.if a row exists implement the logic whatever you want to.
hope this helps.


Yemi Bedu/Ramesh,

Thanks for the responses.

wm.server.query:getServiceStats: is that a built-in Service?

The listener on the queue notifies the document and the service will be executed (or gets triggered). So, I dont believe the document has an identifier (Document ID).

And moreover, if the service fails to execute (for RunTime Errors only) then the doc is rolled back to the queue and the same procedue repeats (listens, notifies and reexecutes service).

So, wish to implement the logic without the intervention of creating table/dumping into DB.

Appreciate your ideas.

The service is in the root package, so it won’t show in developer by default. You have to add this line to your extended fields section under the administrator page:
WHen you save this entry you will need to restart your server. That will make it visible under Developer. Of course, you don’t need this to launch the service, only to have a visual of it.

Oh I didn’t tell you the name of the returned document list, it is “SvcStats”, so you should be good. You may also find some of these postings helpful:
They are not exact to your question, but relevant nonetheless. Good day.

Yemi Bedu