On Tue, Jun 19, 2012 at 11:38:13AM -0700, ddeng wrote:
> In the ProcessStatus class, there are two methods: workitems and
> stored_workitems
> What is the difference?
Hello,
copying the rdoc...
---8<---
# An array of the workitems currently in the storage participant for this
# process instance.
#
# Do not confuse with #workitems
#
attr_reader :stored_workitems
# Returns a list of the workitems currently 'out' to participants
#
# For example, with an instance of
#
# Ruote.process_definition do
# concurrence do
# alpha :task => 'clean car'
# bravo :task => 'sell car'
# end
# end
#
# calling engine.process(wfid).workitems will yield two workitems
# (alpha and bravo).
#
# Warning : do not confuse the workitems here with the workitems held
# in a storage participant or equivalent.
#
def workitems
--->8---
On Tuesday, June 19, 2012 2:45:03 PM UTC-4, John Mettraux wrote:
> On Tue, Jun 19, 2012 at 11:38:13AM -0700, ddeng wrote:
> > In the ProcessStatus class, there are two methods: workitems and > > stored_workitems
> > What is the difference?
> Hello,
> copying the rdoc...
> ---8<--- > # An array of the workitems currently in the storage participant for > this > # process instance. > # > # Do not confuse with #workitems > # > attr_reader :stored_workitems
> # Returns a list of the workitems currently 'out' to participants > # > # For example, with an instance of > # > # Ruote.process_definition do > # concurrence do > # alpha :task => 'clean car' > # bravo :task => 'sell car' > # end > # end > # > # calling engine.process(wfid).workitems will yield two workitems > # (alpha and bravo). > # > # Warning : do not confuse the workitems here with the workitems held > # in a storage participant or equivalent. > # > def workitems > --->8---
> I this example, stored_workitems and workitems will both return two
> workitems
Yes, since stored_workitems returns all the workitems for the process
instance that are "in the storage participant" and workitems returns all the
workitems that are currently being handled by participants (that include
storage participants).
If you have participants that, for example, dispatch work over AMQP and then
wait for an answer to come, the stored_workitems count will be lesser than
the workitems count (actually the stored_workitems count is always inferior
or equal to the workitems count).
If your participants are all storage participants, then the two counts are
equal.