assess_batch

March 26, 2020 Contributors

Name

assess_batch — Allow a module to assume responsibility for batch assessment

Synopsis

#include "hooks/core/assess_batch.h"

| int **core_assess_batch** ( | closure, |   |
|   | dc, |   |
|   | dr, |   |
|   | bs, |   |
|   | conn, |   |
|   | limit_pb, |   |
|   | limit_pc); |   |

void * <var class="pdparam">closure</var>;
delivery_construct * <var class="pdparam">dc</var>;
domain_record * <var class="pdparam">dr</var>;
ec_binding_slot <var class="pdparam">bs</var>;
connection * <var class="pdparam">conn</var>;
int <var class="pdparam">limit_pb</var>;
int <var class="pdparam">limit_pc</var>;

Description

This hook allows a module to assume responsibility for batch assessment. It must read the custom annotation set in the annotate_batch hook from the message context for each message in the batch, set up the batch in the delivery context (see below for "successfully assessed"), and set the batch_assessed flag in the delivery context to true. This hook must be used in conjunction with the core_annotate_batch hook.

If the batch is successfully assessed, the messages must be dequeued from the live queue, validated that the messages belong to the same binding and domain container, and the message pointer must be appended to the delivery_construct.batch ec_ptr_array. When the batch is successfully assessed ‘1’ must be returned. Returning ‘1’ also means no other implementations of this hook will be called.

Parameters

closure

The closure function.

dc

The delivery construct for the message about to be delivered. The message can be found in dc->message. The other parameters are optional, however the caller will take responsibility for determining which messages in a batch are actually eligible for delivery in this batch. For more information about this structure see “delivery_construct”.

dr

The domain record. For information about this structure see “domain_record”. This parameter is optional.

conn

The connection. For information about this structure see “connection”. This parameter is optional.

bs

The binding associated with a message. This parameter is optional.

limit_pb

Limit the number of messages per batch. See the configuration option, max_messages_per_connection. This parameter is optional.

limit_pc

Limit the number of messages per connection. See the configuration option, max_deliveries_per_connection. This parameter is optional.

Return Values

When the batch is successfully assessed, 1 must be returned. Returning 1 also means no other implementations of this hook will be called.

Threading

This hook will be called in the Scheduler thread.

See Also

annotate_batch