Releases: Azure/azure-event-hubs-java
Event Processor Host 2.0.1
com.microsoft.azure.eventprocessorhost
This release consists only of Event Processor Host 2.0.1, which works with the existing Java Event Hubs Client version 1.0.2.
This release fixes issue #360, a potential deadlock when using Event Processor Host 2.0.0 with Client 1.0.2. This deadlock occurred because the Azure Storage-base checkpoint manager was attempting to be asynchronous internally, even though the API exposed by Azure Storage is synchronous. Thus, writing one checkpoint required two threads: one running onEvents and blocking, and another to run the task that calls Azure Storage. Since the Azure Storage API is synchronous, this is wasteful at best. Refactored the checkpoint manager to be mostly synchronous and return pre-completed CompletableFutures. This means that onEvents and the Storage calls run on the same thread. That thread still ends up blocked waiting for Storage, but even if every thread in our threadpool ends up blocked that way, the Storage client has its own separate threadpool internally and can always make progress. The Storage calls will always return (successfully or not) and unblock our threads.
This release also updates dependencies to Azure Storage Client 8.0.0 and Gson 2.8.5.
Here is the corresponding Maven package: https://www.mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/2.0.1
1.0.2
This is the release of version 1.0.2
for azure-eventhubs
. Release notes:
- Refactor session timeout error to be TimeoutException instead of EventHubException
- Change receivePump to start using Executor provided to EventHubClient
- Treat session timeouts as transient
- Implement client timeout for getRuntimeInformation API
- Improve PartitionReceiver.getRuntimeInfo javadoc
- Various fixes
- Remove "put token" messaging on request failures
- Unwrap CompletionException and ExecutionException in ManagementRetry
- Before scheduling task on ReactorDispatcher - verify that its not closed
- Reactor recovers upon unhandled exceptions thrown from proton fx
- Various tests have been added
Event Processor Host 2.0.0
com.microsoft.azure.eventprocessorhost
This release consists only of Event Processor Host 2.0.0, which works with the existing Java Event Hubs Client version 1.0.1.
The only public APIs that have changed are ILeaseManager and ICheckpointManager, which are used in very advanced scenarios. Almost all users can migrate to this version without making any changes in their code. However, the rules of semantic versioning require the bump up to 2.0.0.
General Improvements
- Lease scanning has been refactored and optimized to support event hubs with large numbers of partitions (200+).
- Fixed a leaked EventHubClient which could prevent threadpool shutdown.
Breaking Changes
- Lease class has been split into BaseLease and CompleteLease:
- BaseLease contains the minimum information required for the new PartitionScanner object to make decisions. It has been split out to reduce the data that ILeaseManager.getAllLeases() is required to obtain and return, allowing that method to run more quickly for some lease manager implementations.
- CompleteLease is the base class for implementation-specific derived classes. When used as a return type, it indicates that the object returned contains all information about the lease (and is usually an implementation-specific derived class). When used as an argument type, it indicates that the method expects an object containing all information about the lease. See AzureBlobLease for an example of an implementation-specific derived class.
- ILeaseMananger changes:
- all methods previously taking or returning a Lease now use CompleteLease, except getAllLeases() which returns a list of BaseLease
- new method getLease(), which returns a CompleteLease for a specific partition
- method createLeaseIfNotExists() has been replaced with createAllLeasesIfNotExists() -- if the implementation has a fast way to determine that all leases already exist in the store, it can short-circuit the entire operation at once
- method getLeaseRenewIntervalInMilliseconds() was unused and has been removed
- ICheckpointManager changes:
- method createCheckpointIfNotExists() has been replaced with createAllCheckpointsIfNotExists() -- if the implementation has a fast way to determine that all checkpoint holders already exist in the store, it can short-circuit the entire operation at once
- method updateCheckpoint() takes a CompleteLease instead of a Lease
Here is the corresponding Maven package:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/2.0.0
1.0.1
com.microsoft.azure.eventhubs
- Fixes an issue with
PartitionReceiver.setPrefetchCount()
API (#295)
Here's the corresponding Maven package:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/1.0.1
1.0.0
com.microsoft.azure.eventhubs
Feature Additions
- Support user threadPool: EventHubs library no longer creates any threads or a threadPool. All asynchronous tasks are handed off to the
Executor
provided while creatingEventHubClient
. - Support for
PartitionReceiver
creation based out ofEventData.SequenceNumber
. UseEventPosition.fromSequenceNumber(sequenceNumber)
to create thePartitionReceiver
from a sequenceNumber. ConnectionStringBuilder
supports setters for all properties in fluent-style. Supports adding properties to an existingConnectionString
.
Breaking Changes
EventData
constructors are replaced withEventData.create(...)
variants.- Factory method to create an instance of
EventHubClient
from connection string is renamed fromfromConnectionString
tocreate
. - Factory method to create an instance of
EventHubClient
requires additional parameter -Executor
. - Factory methods to create
PartitionReceiver
instances require a new parameterEventPosition
- as an abstraction to the position of theEventData
(as opposed to takingoffset
,dateTime
orsequenceNumber
). PartitionReceiveHandler
is changed fromabstract class
tointerface
.PartitionReceiver.END_OF_STREAM
andPartitionReceiver.START_OF_STREAM
are replaced byEventPosition.fromEndOfStream()
andEventPosition.fromStartOfStream()
respectively.
com.microsoft.azure.eventprocessorhost
General Improvements
- Previously there was a central loop which periodically scanned the state of all leases and was responsible for taking unowned leases and renewing leases owned by the host instance. The two parts (taking and renewing) have been separated and both are now parallel rather than iterative. This greatly reduces the impact of Azure Storage latency when using the default lease manager.
- All code has been refactored to use
CompletableFuture
and composition. There are no long-running threads and all sleeps have been replaced with scheduled execution.
Breaking Changes
- All deprecated constructors and methods have been removed.
- All
EventProcessorHost
constructors now require a hostname as an argument. Hostnames must be unique. We recommend using the static utility methodEventProcessorHost.createHostName
, which appends a UUID to a user-supplied string, to generate unique but meaningful hostnames. - All
EventProcessorHost
constructors which create a host that uses the default Azure Storage-based lease and checkpoint managers now require a user-supplied Storage container name. (Note that this container name must be the same for all host instances which will consume from the same event hub and consumer group.) - The type of the threadpool argument for
EventProcessorHost
constructors which accept one has changed from ExecutorService to ScheduledExecutorService. - The
registerEventProcessor
andregisterEventProcessorFactory
methods ofEventProcessorHost
now return aCompletableFuture
and do not throw exceptions. TheCompletableFuture
completes normally when initialization is finished or exceptionally if there was an error during initialization. - The
unregisterEventProcessor
method ofEventProcessorHost
now returns aCompletableFuture
and does not throw exceptions. TheCompletableFuture
completes normally when the host instance has finished shutting down or exceptionally if there was an error during shutdown. - The initial offset provider which could previously be set via
EventProcessorOptions
has been renamed the initial position provider and requires the newEventPosition
type. - The
checkpoint
methods ofPartitionContext
now return aCompletableFuture
which completes normally when the checkpoint has been persisted successfully or exceptionally if there was an error. - Methods of the
ICheckpointManager
andILeaseManager
interfaces have been changed to useCompletableFuture
instead ofFuture
. This change only affects those implementing checkpoint and lease managers.
Here are the corresponding Maven packages:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/1.0.0
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/1.0.0
0.16.0-PREVIEW
This is a PREVIEW version of Event Hubs java client which extends support for Role Based Access Control and Managed Service Identity.
com.microsoft.azure.eventhubs
- Support Role Based Access Control using Azure Active Directory for Send and Receive Operations
- Support Managed Service Identity for Send and Receive Operations
API's added
EventHubClient.createWithManagedServiceIdentity( final URI endpointAddress, final String eventHubName)
EventHubClient.create( final URI endpointAddress, final String eventHubName, final AuthenticationContext authenticationContext, final ClientCredential clientCredential)
Here is the corresponding Maven package:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/0.16.0-PREVIEW
0.15.1
com.microsoft.azure.eventhubs
- Cleanup the thread created by
EventHubClient
, when initialization fails (#192) - Correct the exception contract when, creating a
PartitionSender
/PartitionReceiver
fails during authorization phase (#196) - Tracing improvements - to improve debugging experience in
ClientEntity
&Connection
close scenarios (195)
com.microsoft.azure.eventhubs.eventprocessorhost
- Offer
InMemory
implementations forICheckpointManager
andILeaseManager
, for testability (#194)
Here is the corresponding Maven package:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/0.15.1
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/0.15.1
0.15.0
Important breaking changes
- All classes etc. in package
com.microsoft.azure.servicebus
have been moved to packagecom.microsoft.azure.eventhubs
. This is because the Microsoft Azure Service Bus Client for Java also used the package namecom.microsoft.azure.servicebus
, causing a conflict for anyone who wanted to use Event Hubs and Queues or Topics at the same time. - Logging has been migrated from
java.util.logging
toSLF4J
. Loggers are now namedcom.microsoft.azure.eventhubs.class
andcom.microsoft.azure.eventprocessorhost.class
. - Added batch send APIs on
EventHubClient
andPartitionSender
.
com.microsoft.azure.eventhubs
com.microsoft.azure.eventprocessorhost
- EventHubClient.getRuntime methods provide better error if EventHubClient is closed (#176)
- Made thread pool non-static (#163)
Here are the corresponding Maven packages:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/0.15.0
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/0.15.0
0.14.5
com.microsoft.azure.eventhubs
- Fix transport state transition during close (#154)
- Cancel pending requests when request-response link is closed by the service (#155)
Here is the corresponding Maven package:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/0.14.5
0.14.4
com.microsoft.azure.eventhubs
- Support EventData size negotiation feature (#90)
com.microsoft.azure.eventhubs.eph
- Fix a race condition as a result of which, EPH fails to invoke IEventProcessor.onClose handler (#150)
Here are the corresponding Maven packages:
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs/0.14.4
https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-eph/0.14.4