Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Bus: Track 2 Preview 1 API surface #7196

Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
43ae28c
No changes, just ran prettier.
richardpark-msft Feb 26, 2020
5085719
iterator model needs work but everything else is pretty much correct …
richardpark-msft Feb 26, 2020
c899c1f
Looks like we're good for the first preview review of the surface.
richardpark-msft Feb 27, 2020
06e0bab
Just updated with:
richardpark-msft Feb 29, 2020
14d5471
Removed the "uselessemptycontext"
richardpark-msft Feb 29, 2020
682363d
Merge remote-tracking branch 'upstream/master' into richardpark-sb-tr…
richardpark-msft Feb 29, 2020
245159f
* streamMessages() renamed to subscribe() to match track 2 for EventHubs
richardpark-msft Mar 3, 2020
eafc9cc
Fix auths parameter name.
richardpark-msft Mar 3, 2020
5b0eb96
- Moved to a parent client model (ServiceBusClient)
richardpark-msft Mar 6, 2020
035e9e4
- adding options so users can trace or add in abortsignals
richardpark-msft Mar 6, 2020
1a7f2c4
Adding in OperationOptions to more methods
richardpark-msft Mar 6, 2020
efdad44
Unneeded exports
richardpark-msft Mar 6, 2020
6e82d4e
updating with more surface changes
richardpark-msft Mar 6, 2020
d9e7315
updated from latest checkin with message settlement methods moved
richardpark-msft Mar 18, 2020
c21985a
updated with getDeadLetterReceiver() and SubscriptionRuleManager
richardpark-msft Mar 20, 2020
5a186d1
updated as of 6d5abc8262a8b09d158a927c055c384d2b0498ca (2020-03-27)
richardpark-msft Mar 28, 2020
2aee588
Merge remote-tracking branch 'origin/master' into richardpark-sb-trac…
ramya-rao-a Apr 3, 2020
a8dd85b
Update the stand-alone api view
ramya-rao-a Apr 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
337 changes: 337 additions & 0 deletions service-bus.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
## API Report File for "@azure/service-bus"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { AmqpMessage } from "@azure/core-amqp";
import { delay } from "@azure/core-amqp";
import { Delivery } from "rhea-promise";
import Long from "long";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need an issue to discuss the long and short of Long

import { MessagingError } from "@azure/core-amqp";
import { OperationOptions } from "@azure/core-auth";
import { RetryOptions } from "@azure/core-amqp";
import { TokenCredential } from "@azure/core-amqp";
import { TokenType } from "@azure/core-amqp";
import { WebSocketImpl } from "rhea-promise";
import { WebSocketOptions } from "@azure/core-amqp";

// @public
export interface CorrelationFilter {
contentType?: string;
correlationId?: string;
label?: string;
messageId?: string;
replyTo?: string;
replyToSessionId?: string;
sessionId?: string;
to?: string;
userProperties?: any;
}

// @public
export interface CreateBatchOptions extends OperationOptions {
maxSizeInBytes?: number;
}

// @public
export interface DeadLetterOptions {
deadLetterErrorDescription: string;
deadLetterReason: string;
}

export { delay };

export { Delivery };

// @public
export interface GetMessageIteratorOptions extends OperationOptions, WaitTimeOptions {}

// @public
export interface GetReceiverOptions {
retryOptions?: RetryOptions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The theory that one would want to have retry options for a sender/receiver that is different from the ones set on the client is not a proved one. This should be something we add when we have user feedback for the same. Since this can be additional, we can always add it back.

}

// @public
export interface GetSenderOptions {
retryOptions?: RetryOptions;
}

// @public
export interface GetSessionReceiverOptions extends SessionReceiverOptions, OperationOptions {}

// @public
export interface GetSubscriptionRuleManagerOptions {
retryOptions?: RetryOptions;
}

// @public
export interface MessageHandlerOptions {
autoComplete?: boolean;
maxConcurrentCalls?: number;
maxMessageAutoRenewLockDurationInSeconds?: number;
}

// @public
export interface MessageHandlers<ReceivedMessageT> {
processError(err: Error): Promise<void>;
processMessage(message: ReceivedMessageT): Promise<void>;
}

export { MessagingError };

// @public
export interface ReceiveBatchOptions extends OperationOptions, WaitTimeOptions {}

// @public
export interface ReceivedMessage extends ServiceBusMessage {
readonly _amqpMessage: AmqpMessage;
readonly deadLetterSource?: string;
readonly deliveryCount?: number;
readonly enqueuedSequenceNumber?: number;
readonly enqueuedTimeUtc?: Date;
readonly expiresAtUtc?: Date;
lockedUntilUtc?: Date;
readonly lockToken?: string;
readonly sequenceNumber?: Long;
}

// @public
export interface ReceivedMessageWithLock extends ReceivedMessage {
abandon(propertiesToModify?: { [key: string]: any }): Promise<void>;
complete(): Promise<void>;
deadLetter(
options?: DeadLetterOptions & {
[key: string]: any;
}
): Promise<void>;
defer(propertiesToModify?: { [key: string]: any }): Promise<void>;
renewLock(): Promise<Date>;
}

// @public
export interface Receiver<ReceivedMessageT> {
close(): Promise<void>;
diagnostics: {
peek(maxMessageCount?: number): Promise<ReceivedMessage[]>;
peekBySequenceNumber(
fromSequenceNumber: Long,
maxMessageCount?: number
): Promise<ReceivedMessage[]>;
};
entityPath: string;
getMessageIterator(options?: GetMessageIteratorOptions): AsyncIterableIterator<ReceivedMessageT>;
isReceivingMessages(): boolean;
receiveBatch(maxMessages: number, options?: ReceiveBatchOptions): Promise<ReceivedMessageT[]>;
receiveDeferredMessage(
sequenceNumber: Long,
options?: OperationOptions
): Promise<ReceivedMessageT | undefined>;
receiveDeferredMessages(
sequenceNumbers: Long[],
options?: OperationOptions
): Promise<ReceivedMessageT[]>;
receiveMode: "peekLock" | "receiveAndDelete";
subscribe(handlers: MessageHandlers<ReceivedMessageT>, options?: SubscribeOptions): void;
}

export { RetryOptions };

// @public
export interface RuleDescription {
action?: string;
filter?: string | CorrelationFilter;
name: string;
}

// @public
export interface Sender {
cancelScheduledMessage(sequenceNumber: Long): Promise<void>;
cancelScheduledMessages(sequenceNumbers: Long[]): Promise<void>;
close(): Promise<void>;
createBatch(options?: CreateBatchOptions): Promise<ServiceBusMessageBatch>;
isClosed: boolean;
scheduleMessage(scheduledEnqueueTimeUtc: Date, message: ServiceBusMessage): Promise<Long>;
scheduleMessages(scheduledEnqueueTimeUtc: Date, messages: ServiceBusMessage[]): Promise<Long[]>;
send(message: ServiceBusMessage): Promise<void>;
sendBatch(messageBatch: ServiceBusMessageBatch): Promise<void>;
}

// @public
export class ServiceBusClient {
constructor(connectionString: string, options?: ServiceBusClientOptions);
constructor(
hostName: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostName -> fullyQualifiedNamespace

tokenCredential: TokenCredential,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenCredential -> credential

options?: ServiceBusClientOptions
);
close(): Promise<void>;
getDeadLetterReceiver(
queueName: string,
receiveMode: "peekLock",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create an issue to discuss the need to make receive mode a mandatory parameter

options?: GetReceiverOptions
): Receiver<ReceivedMessageWithLock>;
getDeadLetterReceiver(
queueName: string,
receiveMode: "receiveAndDelete",
options?: GetReceiverOptions
): Receiver<ReceivedMessage>;
getDeadLetterReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "peekLock",
options?: GetReceiverOptions
): Receiver<ReceivedMessageWithLock>;
getDeadLetterReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "receiveAndDelete",
options?: GetReceiverOptions
): Receiver<ReceivedMessage>;
getReceiver(
queueName: string,
receiveMode: "peekLock",
options?: GetReceiverOptions
): Receiver<ReceivedMessageWithLock>;
getReceiver(
queueName: string,
receiveMode: "receiveAndDelete",
options?: GetReceiverOptions
): Receiver<ReceivedMessage>;
getReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "peekLock",
options?: GetReceiverOptions
): Receiver<ReceivedMessageWithLock>;
getReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "receiveAndDelete",
options?: GetReceiverOptions
): Receiver<ReceivedMessage>;
getSender(queueOrTopicName: string, options?: GetSenderOptions): Sender;
getSessionReceiver(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have feedback for this to be async. We need issue to talk about getReceiver and getSender to be async as well

queueName: string,
receiveMode: "peekLock",
options?: GetSessionReceiverOptions
): SessionReceiver<ReceivedMessageWithLock>;
getSessionReceiver(
queueName: string,
receiveMode: "receiveAndDelete",
options?: GetSessionReceiverOptions
): SessionReceiver<ReceivedMessage>;
getSessionReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "peekLock",
options?: GetSessionReceiverOptions
): SessionReceiver<ReceivedMessageWithLock>;
getSessionReceiver(
topicName: string,
subscriptionName: string,
receiveMode: "receiveAndDelete",
options?: GetSessionReceiverOptions
): SessionReceiver<ReceivedMessage>;
getSubscriptionRuleManager(
topic: string,
subscription: string,
options?: GetSubscriptionRuleManagerOptions
): SubscriptionRuleManager;
}

// @public
export interface ServiceBusClientOptions {
retryOptions?: RetryOptions;
webSocketOptions?: WebSocketOptions;
}

// @public
export interface ServiceBusMessage {
body: any;
contentType?: string;
correlationId?: string | number | Buffer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from @bterlson is that this should support UInt8array as well if it supports Buffer

label?: string;
messageId?: string | number | Buffer;
partitionKey?: string;
replyTo?: string;
replyToSessionId?: string;
scheduledEnqueueTimeUtc?: Date;
sessionId?: string;
timeToLive?: number;
to?: string;
userProperties?: {
[key: string]: any;
};
viaPartitionKey?: string;
}

// @public
export interface ServiceBusMessageBatch {
readonly count: number;
readonly maxSizeInBytes: number;
readonly sizeInBytes: number;
tryAdd(message: ServiceBusMessage): boolean;
}

// @public
export interface SessionMessageHandlerOptions {
autoComplete?: boolean;
maxConcurrentCalls?: number;
}

// @public
export interface SessionReceiver<
ReceivedMessageT extends ReceivedMessage | ReceivedMessageWithLock
> extends Receiver<ReceivedMessageT> {
diagnostics: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diagnostics can give the impression that one can have diagnostic operations on the state of the receiver. If the intention here is to avoid confusion between peek() the method and peeklock the mode, then we can experiment with browse first

peek(maxMessageCount?: number): Promise<ReceivedMessage[]>;
peekBySequenceNumber(
fromSequenceNumber: Long,
maxMessageCount?: number
): Promise<ReceivedMessage[]>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move the count and the sequence number to options along with operation options

};
getState(): Promise<any>;
renewSessionLock(): Promise<Date>;
sessionId: string | undefined;
sessionLockedUntilUtc: Date | undefined;
setState(state: any): Promise<void>;
}

// @public
export interface SessionReceiverOptions {
maxSessionAutoRenewLockDurationInSeconds?: number;
Copy link
Contributor

@ramya-rao-a ramya-rao-a Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

milli seconds and maybe maxAutoRenewLockDurationInMs or autoRenewLockDurationInMs

retryOptions?: RetryOptions;
sessionId: string | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark as optional parameter instead of | undefined?

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface isn't being used anywhere


// @public
export interface SubscribeOptions extends OperationOptions, MessageHandlerOptions {}

// @public
export interface SubscriptionRuleManager {
addRule(
ruleName: string,
filter: boolean | string | CorrelationFilter,
sqlRuleActionExpression?: string
): Promise<void>;
close(): Promise<void>;
readonly defaultRuleName: string;
getRules(): Promise<RuleDescription[]>;
removeRule(ruleName: string): Promise<void>;
}

export { TokenCredential };

export { TokenType };

// @public
export interface WaitTimeOptions {
maxWaitTimeInMs: number;
}

export { WebSocketImpl };

export { WebSocketOptions };

// (No @packageDocumentation comment for this package)
```