@azure/event-hubs
Version:
Azure Event Hubs SDK for JS.
69 lines • 2.28 kB
TypeScript
import { EventData } from "./eventData.js";
/**
* A message with payload and content type fields
*
* This interface is hidden because it is already exported by `@azure/schema-registry-avro`
*
* @hidden
*/
export interface MessageContent {
/**
* The message's binary data
*/
data: Uint8Array;
/**
* The message's content type
*/
contentType: string;
}
/**
* A message adapter interface that specifies methods for producing and consuming
* messages with payloads and content type fields.
*
* This interface is hidden because it is already exported by `@azure/schema-registry-avro`
*
* @hidden
*/
export interface MessageAdapter<MessageT> {
/**
* defines how to create a message from a payload and a content type
*/
produce: (MessageContent: MessageContent) => MessageT;
/**
* defines how to access the payload and the content type of a message
*/
consume: (message: MessageT) => MessageContent;
}
/**
* Parameters to the `createEventDataAdapter` function that creates an event data adapter.
*/
export interface EventDataAdapterParameters {
/**
* The correlation identifier that allows an
* application to specify a context for the message for the purposes of correlation, for example
* reflecting the MessageId of a message that is being replied to.
*/
correlationId?: string | number | Buffer;
/**
* The message identifier is an
* application-defined value that uniquely identifies the message and its payload.
*
* Note: Numbers that are not whole integers are not allowed.
*/
messageId?: string | number | Buffer;
/**
* Set of key value pairs that can be used to set properties specific to user application.
*/
properties?: {
[key: string]: any;
};
}
/**
* A function that constructs an event data adapter. That adapter can be used
* with `@azure/schema-registry-avro` to encode and decode body in event data.
*
* @param params - parameters to create the event data
* @returns An event data adapter that can produce and consume event data
*/
export declare function createEventDataAdapter(params?: EventDataAdapterParameters): MessageAdapter<EventData>;
//# sourceMappingURL=eventDataAdapter.d.ts.map