All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.messaging.eventhubs.models.SendBatchFailedContext Maven / Gradle / Ivy

There is a newer version: 5.19.2
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.messaging.eventhubs.models;

import com.azure.messaging.eventhubs.EventData;
import com.azure.messaging.eventhubs.EventHubBufferedProducerAsyncClient;
import com.azure.messaging.eventhubs.EventHubBufferedProducerClient;

/**
 * Contains information about a batch that was unable to be published, as well as the exception that occurred and the
 * partition that the batch was being published to.
 *
 * @see EventHubBufferedProducerClient
 * @see EventHubBufferedProducerAsyncClient
 */
public final class SendBatchFailedContext {
    private final Iterable events;
    private final String partitionId;
    private final Throwable throwable;

    /**
     * Creates a new instance.
     *
     * @param events Events associated with the failed batch.
     * @param partitionId Partition that the events went to.
     * @param throwable Error associated with the failed batch.
     */
    public SendBatchFailedContext(Iterable events, String partitionId, Throwable throwable) {
        this.events = events;
        this.partitionId = partitionId;
        this.throwable = throwable;
    }

    /**
     * Gets the events that failed to send.
     *
     * @return The events that failed to send.
     */
    public Iterable getEvents() {
        return events;
    }

    /**
     * Gets the partition id that the failed batch went to.
     *
     * @return The partition id that the failed batch went to.
     */
    public String getPartitionId() {
        return partitionId;
    }

    /**
     * Gets the error that occurred when sending the batch.
     *
     * @return The error that occurred when sending the batch.
     */
    public Throwable getThrowable() {
        return throwable;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy