Skip to main content

sow-and-sub-aggregated

Import the AMPS library:

import AMPS

Construct the command:

cmd = AMPS.Command(AMPS.Message.Command.SOWAndSubscribe)

# set options
cmd.set_options(opts.OOF + \
opts.NoEmpties + \
opts.Projection("/id as /id, COUNT(values) as /valueCount") + \
opts.Grouping("/id") )

# set the topic and ordering for the command
cmd.set_topic(topic).set_order_by("/id DESC")

The command can now be used in execute or execute_async.