- The sender is refactored to avoid the warning around too may listeners being attached which would occur before if too many send requests were in flight at the same time from the same sender.
- The receiver is refactored to allow the same underlying AMQP link to be shared between streaming and batching mode. This results in seamless transition between the three different receive methods on the
EventHubConsumer
- All time related entites have been updated to use milli seconds as the unit of time for consistency.
- New error
InsufficientCreditError
is introduced for the scenario where rhea is unable to send events due to its internal buffer being full. This is a transient error and so is treated as retryable. - The error
OperationTimeoutError
was previously mistakenly classified as an AMQP error which is now corrected. Since this can also be a transient error, it is treated as retryable.
- Added method
createBatch()
on theEventHubProducer
to create anEventDataBatch
that can then be used to add events until the maximum size is reached.- This batch object can then be used in the
send()
method to send all the added events to Event Hubs. - This allows publishers to build batches without the possibility of encountering the error around the message size exceeding the supported limit when sending events.
- It also allows publishers with bandwidth concerns to control the size of each batch published.
- This batch object can then be used in the
- Introduced a new class
EventProcessor
which replaces the older concept of Event Processor Host.- This early preview is intended to allow users to test the new design using a single instance of
EventProcessor
. The ability to store checkpoints to a durable store will be added in future updates
- This early preview is intended to allow users to test the new design using a single instance of
- The properties on the
RetryOptions
interface have been renamed for ease of use. - New property
timeoutInMs
onRetryOptions
to configure the time to wait before declaring an attempt to have failed withOperationTimeoutError
error which is retryable. - New properties
mode
andmaxRetryDelayInMs
onRetryOptions
to configure the exponential retry mode that is now supported
Version 5.0.0-preview.1 is a preview of our efforts to create a client library that is user friendly and idiomatic to the Javascript ecosystem. The reasons for most of the changes in this update can be found in the Azure SDK Design Guidelines for TypeScript. For more information, please visit https://aka.ms/azure-sdk-preview1-js
- Creating an instance of EventHubClient
is now done using construtor overloads instead of static helpers.
- If you previously used the
createFromTokenProvider
static helper to provide your own custom token provider, you will now need to update the provider to follow the newTokenCredential
interface instead. - If you previously used the
@azure/ms-rest-nodeauth
library to provide AAD credentials, you will now need to use the new @azure/identity library instead.
- If you previously used the
- The send methods are moved from the
EventHubClient
class to the new EventHubProducer class.- Use the createProducer()
function on the
EventHubClient
to create an instance of aEventHubProducer
. - Each producer represents a dedicated AMQP sender link to Azure Event Hubs.
- The EventData type used for
the data being sent only supports a
body
for the content being sent and aproperties
bag to hold any custom metadata you want to send. The properties corresponding to a received event are removed from this type and a separate type ReceivedEventData is used for received events.
- Use the createProducer()
function on the
- The receive methods are moved from the
EventHubClient
class to the new EventHubConsumer class.- Use the createConsumer()
function on the
EventHubClient
to create an instance of aEventHubConsumer
. - Each consumer represents a dedicated AMQP receiver link to Azure Event Hubs based
on the flavor of receive function being used i.e
receiveBatch()
that receives events in a batch vsreceive()
that provides a streaming receiver. - The static methods
EventPosition.fromStart()
andEventPosition.fromEnd()
are renamed toEventPosition.earliest()
andEventPosition.latest()
respectively.
- Use the createConsumer()
function on the
- Inspecting Event Hub
- The methods
getHubRuntimeInformation()
andgetPartitionInformation()
on theEventHubClient
are renamed to getProperties() and getPartitionProperties() respectively. Please refer to the return types of these functions to ensure you are using the right property names.
- The methods
- You can now configure retry options that are used to govern retry attempts when a retryable error occurs. These can be
set when creating the
EventHubClient
,EventHubProducer
andEventHubConsumer
- You can now pass an abort signal to any of the async operations. This signal can be used to cancel such operations. Use the package @azure/abort-controller to create such abort signals.
- An async iterator is now available to receive events after you create an instance of
EventHubConsumer
. Use the function getEventIterator() on the consumer to get aAsyncIterableIterator
which you can then use in a loop or use it'snext()
function to receive events.
- Refer to the API reference documentation to get an overview of the entire API surface.
- Refer to our samples to understand the usage of the new APIs.
- Added support for WebSockets. WebSockets enable Event Hubs to work over an HTTP proxy and in environments where the standard AMQP port 5671 is blocked. Refer to the websockets sample to see how to use WebSockets.
@types/async-lock
has been moved to being a dependency from a dev-dependency. This fixes the bug 3240
- If you have been using the
createFromAadTokenCredentials
function to create an instance of theEventHubClient
, you will now need to use the @azure/ms-rest-nodeauth library instead of ms-rest-azure library to create the credentials that are needed by thecreateFromAadTokenCredentials
function.- Typescript: Replace
import * from "ms-rest-azure";
withimport * from "@azure/ms-rest-nodeauth";
- Javascript: Replace
require("ms-rest-azure")
withrequire("@azure/ms-rest-nodeauth")
- Typescript: Replace
- If you have been passing a non string value in the
partitionKey
property on the message when sending it using theEventHubClient
, an error will now be thrown. This property only supports string values.
- A network connection lost error is now treated as retryable error. A new error with name
ConnectionLostError
is introduced for this scenario which you can see if you enable the logs. - When recovering from an error that caused the underlying AMQP connection to get disconnected,
rhea reconnects all the older AMQP links on the connection
resulting in the below 2 errors in the logs. We now clear rhea's internal map to avoid such reconnections.
We already have code in place to create new AMQP links to resume send/receive operations.
- InvalidOperationError: A link to connection '.....' $cbs node has already been opened.
- UnauthorizedError: Unauthorized access. 'Listen' claim(s) are required to perform this operation.
- Enabled the
esModuleInterop
compilerOption in thetsconfig.json
file for this library to be compliant with the best practices.
- Use
isItselfClosed()
instead ofisClosed()
in rhea to correctly determine if the sdk initiated close on receiver/sender. This ensures that on connection issues like the ECONNRESET error, the receivers get re-connected properly thus fixing the bug 174
- Only set
message_id
while sending the message, when provided by caller PR.
- export
EventHubConnectionConfig
from the library.
- Moved
lib/amqp-common
to"@azure/amqp-common"
package and took a dependency on it. - Moved
lib/rhea-promise
to"rhea-promise"
package and took a dependency on it. - Fixed issues where the private instance of
rhea receiver or sender
were undefined when*_open
and*_close
events happened instantaneously.
- update the version of ms-rest-azure to "2.5.9"
EventPosition.fromSequenceNumber()
accepts0
as a valid argument.client.receive()
andclient.receiveBatch()
accept partitionId as astring | number
.- User's error handler in
client.receive()
will only be notified if the user did not close the receiver and the error is not retryable.
client.getPartitionInformation()
should works as expected when partitionId is of typenumber | string
.
- Stable version of the libray.
- Added support to provide custom user-agent string that will be appended to the default user agent string.
- Updated examples and content in README.md
- Fixed issue
- Added error handlers to the $management sender/receiver links.
- Added error handlers to the amqp session of the $management and $cbs sender/receiver links.
- Exported
AadTokenProvider
andSasTokenProvider
from the client.
- Improved logging statements to the connection context.
- Added timeout to promisifed creation/closing of rhea sender, receiver, session, connection.
- Fixed a bug in the EventData deserialization logic by checking for
!= undefined
check rather than the!
check. - While handling disconnects we retry for 150 times at an interval of 15 seconds as long the error is
retryable
.
- Improved log statements.
- Documented different mechanisms of getting the debug logs in README.
- Minimum dependency on
"rhea": "^0.2.18"
. - Fixed bugs in recovery logic
- Added support to recover from session close for sender and receiver
- Added a new property
isConnecting
that provides information whether a linkEntity is currently in the process of establishing itself. - Using
is_closed()
method of sender, receiver and session in rhea to determine whether the sdk initiated the close. - MessagingError is retryable by default.
- Added support to translate node.js
SystemError
into AmqpError. - Added a new static method
createFromTokenProvider()
on the EventHubClient where customers can provide their own TokenProvider.
- Improved log statements
- Updated README.md
- Updated dependency rhea to "^0.2.16" instead of github dependency.
- Added support to handle disconnects and link timeout errors.
- Fixed client examples link in README.
- Updated issue templates
- Improvised the example structure
- Moved the common stuff to
amqp-common
and addedConnection
,Session
,Sender
,Receiver
objects torhea-promise
. - Improved tsconfig.json and tslint.json config files.
- Added
import "mocha"
to all the test files, inorder to get rid of red squiggles in vscode. - Replaced crypto with jssha which is browser compatible
- Minor doc fixes and sample updates.
- Add a listener for the disconnected event after opening the connection.
- Fixed the partitionkey issue while sending events. #73.
- Bumped the minimum dependency on rhea to 0.2.13. This gives us type definitions for rhea.
- rpc.open() returns the connection object. This makes it easy to extract common functionality to a separate library.
- Added support to create EventHubClient from an IotHub connectionstring. The following can be done
const client = await EventHubClient.createFromIotHubConnectionString(process.env.IOTHUB_CONNECTION_STRING);
- Internal design changes:
- ManagementClient also does cbs auth before making the management request.
- EventHubSender, EventHubReceiver, ManagementClient inherit from a base class ClientEntity.
- Moved opening the connection to CbSClient as that is the first thing that should happen after opening the connection. This reduces calls to
rpc.open()
all over the sdk and puts them at one place in theinit()
method on the CbsClient.
- Added functionality to encode/decode the messages sent and received.
- Created an options object in the
client.createFromConnectionString()
and theEventHubClient
constructor. This is a breaking change. However moving to an options object design reduces the chances of breaking changes in the future. This options object will: - have the existing optional
tokenProvider
property - and a new an optional property named
dataTransformer
. You can provide your own transformer. If not provided then we will use the DefaultDataTransformer. This should be applicable for majority of the scenarios and will ensure that messages are interoperable between different Azure services. It fixes issue #60.
- Added missing dependency for
uuid
package and nit fixes in the README.md
- Changing
client.receiveOnMessage()
toclient.receive()
as that is a better naming convention and is in sync with other language sdks.
- Previously we were depending on amqp10 package for the amqp protocol. Moving forward we will be depending on rhea.
- The public facing API of this library has major breaking changes from the previous version 0.0.8. Please take a look at the Readme and the samples directory for detailed samples.
- Removed the need to say
client.open.then()
. First call to create a sender, receiver or get metadata about the hub or partition will establish the AMQP connection. - Added support to authenticate via Service Principal credentials, MSITokenCredentials, DeviceTokenCredentials.
- This should make it easy for customers to login once using the above mentioned credentials,
- Create the EventHubs infrastructure on the Azure management/control plane programmatically using (azure-arm-eventhubs) package over HTTPS prtocol.
- Use the same credentials to send and receive messages to the EventHub using this library over AMQP protocol.
- This should make it easy for customers to login once using the above mentioned credentials,
- Provided a promise based API to create senders/receivers off the
EventHubClient
. - Added capability to send multiple messages by batching them together.
- Added capability to receive predefined number of messages for a specified amount of time. Note that this method will receive all the messages and return an array of EventData objects.
- Added capability to create an epoch receiver.
- Simplified the mechanism to specify the
EventPosition
from which to receive messages from the EventHub. - Added proper TypeScript type definitions to the library that improves the intellisense experience for our customers.
- Fixed a race condition within the AMQP redirection code when using an IoT Hub connection string.
- Disabled auto-retry of AMQP connections in amqp10 since the current client is not built to handle them and fails when retrying.
- Pulled changes for #14 and #20/#21.
- Special thanks to @kurtb and @ali92hm for their contributions!
- Added support for message properties in the EventData structure.