com.azure.communication.callautomation.implementation.eventprocessor.EventAwaiterSingleTime Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-communication-callautomation Show documentation
Show all versions of azure-communication-callautomation Show documentation
This package contains clients and data structures used to make call with Azure Communication Call Automation Service.
For this release, see notes - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/README.md and https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/CHANGELOG.md.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.communication.callautomation.implementation.eventprocessor;
import com.azure.communication.callautomation.models.events.CallAutomationEventBase;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Sinks;
import java.util.function.Predicate;
/**
* A class that represents an event awaiter that will only wait for a single event.
*/
public final class EventAwaiterSingleTime extends EventAwaiter {
private final Predicate predicate;
private final Sinks.One task;
public EventAwaiterSingleTime(Predicate predicate) {
super();
this.predicate = predicate;
this.task = Sinks.one();
}
@Override
public void onEventsReceived(EventWithBacklogId event) {
if (predicate.test(event.getEvent())) {
task.tryEmitValue(event);
}
}
public Mono getEventWithBacklogId() {
return task.asMono();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy