Skip to content

Commit

Permalink
Support service bus batching (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba committed Sep 12, 2023
1 parent 1f21c2f commit 2205716
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions types/InvocationContext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ export interface InvocationContextExtraOutputs {
/**
* Set a secondary Service Bus queue output for this invocation
* @output the configuration object for this Service Bus output
* @message the output message value
* @message the output message(s) value
*/
set(output: ServiceBusQueueOutput, message: unknown): void;
set(output: ServiceBusQueueOutput, messages: unknown): void;

/**
* Set a secondary Service Bus topic output for this invocation
* @output the configuration object for this Service Bus output
* @message the output message value
* @message the output message(s) value
*/
set(output: ServiceBusTopicOutput, message: unknown): void;
set(output: ServiceBusTopicOutput, messages: unknown): void;

/**
* Set a secondary Event Hub output for this invocation
Expand Down
12 changes: 11 additions & 1 deletion types/serviceBus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { FunctionOptions, FunctionOutput, FunctionResult, FunctionTrigger } from './index';
import { InvocationContext } from './InvocationContext';

export type ServiceBusQueueHandler = (message: unknown, context: InvocationContext) => FunctionResult;
export type ServiceBusQueueHandler = (messages: unknown, context: InvocationContext) => FunctionResult;

export interface ServiceBusQueueFunctionOptions extends ServiceBusQueueTriggerOptions, Partial<FunctionOptions> {
handler: ServiceBusQueueHandler;
Expand All @@ -27,6 +27,11 @@ export interface ServiceBusQueueTriggerOptions {
* `true` if connecting to a [session-aware](https://docs.microsoft.com/azure/service-bus-messaging/message-sessions) queue. Default is `false`
*/
isSessionsEnabled?: boolean;

/**
* Set to `many` in order to enable batching. If omitted or set to `one`, a single message is passed to the function.
*/
cardinality?: 'many' | 'one';
}
export type ServiceBusQueueTrigger = FunctionTrigger & ServiceBusQueueTriggerOptions;

Expand Down Expand Up @@ -71,6 +76,11 @@ export interface ServiceBusTopicTriggerOptions {
* `true` if connecting to a [session-aware](https://docs.microsoft.com/azure/service-bus-messaging/message-sessions) subscription. Default is `false`
*/
isSessionsEnabled?: boolean;

/**
* Set to `many` in order to enable batching. If omitted or set to `one`, a single message is passed to the function.
*/
cardinality?: 'many' | 'one';
}
export type ServiceBusTopicTrigger = FunctionTrigger & ServiceBusTopicTriggerOptions;

Expand Down

0 comments on commit 2205716

Please sign in to comment.