Skip to content

Commit 2205716

Browse files
authored
Support service bus batching (#132)
1 parent 1f21c2f commit 2205716

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

types/InvocationContext.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ export interface InvocationContextExtraOutputs {
163163
/**
164164
* Set a secondary Service Bus queue output for this invocation
165165
* @output the configuration object for this Service Bus output
166-
* @message the output message value
166+
* @message the output message(s) value
167167
*/
168-
set(output: ServiceBusQueueOutput, message: unknown): void;
168+
set(output: ServiceBusQueueOutput, messages: unknown): void;
169169

170170
/**
171171
* Set a secondary Service Bus topic output for this invocation
172172
* @output the configuration object for this Service Bus output
173-
* @message the output message value
173+
* @message the output message(s) value
174174
*/
175-
set(output: ServiceBusTopicOutput, message: unknown): void;
175+
set(output: ServiceBusTopicOutput, messages: unknown): void;
176176

177177
/**
178178
* Set a secondary Event Hub output for this invocation

types/serviceBus.d.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { FunctionOptions, FunctionOutput, FunctionResult, FunctionTrigger } from './index';
55
import { InvocationContext } from './InvocationContext';
66

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

99
export interface ServiceBusQueueFunctionOptions extends ServiceBusQueueTriggerOptions, Partial<FunctionOptions> {
1010
handler: ServiceBusQueueHandler;
@@ -27,6 +27,11 @@ export interface ServiceBusQueueTriggerOptions {
2727
* `true` if connecting to a [session-aware](https://docs.microsoft.com/azure/service-bus-messaging/message-sessions) queue. Default is `false`
2828
*/
2929
isSessionsEnabled?: boolean;
30+
31+
/**
32+
* Set to `many` in order to enable batching. If omitted or set to `one`, a single message is passed to the function.
33+
*/
34+
cardinality?: 'many' | 'one';
3035
}
3136
export type ServiceBusQueueTrigger = FunctionTrigger & ServiceBusQueueTriggerOptions;
3237

@@ -71,6 +76,11 @@ export interface ServiceBusTopicTriggerOptions {
7176
* `true` if connecting to a [session-aware](https://docs.microsoft.com/azure/service-bus-messaging/message-sessions) subscription. Default is `false`
7277
*/
7378
isSessionsEnabled?: boolean;
79+
80+
/**
81+
* Set to `many` in order to enable batching. If omitted or set to `one`, a single message is passed to the function.
82+
*/
83+
cardinality?: 'many' | 'one';
7484
}
7585
export type ServiceBusTopicTrigger = FunctionTrigger & ServiceBusTopicTriggerOptions;
7686

0 commit comments

Comments
 (0)