pl.allegro.tech.hermes.consumers.consumer.sender.resolver.EndpointAddressResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-consumers Show documentation
Show all versions of hermes-consumers Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.consumers.consumer.sender.resolver;
import pl.allegro.tech.hermes.api.EndpointAddress;
import pl.allegro.tech.hermes.api.EndpointAddressResolverMetadata;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.batch.MessageBatch;
import java.net.URI;
import java.util.Collections;
import java.util.List;
public interface EndpointAddressResolver {
default URI resolve(EndpointAddress address, Message message, EndpointAddressResolverMetadata metadata)
throws EndpointAddressResolutionException {
return resolve(address);
}
default URI resolve(EndpointAddress address, MessageBatch batch, EndpointAddressResolverMetadata metadata)
throws EndpointAddressResolutionException {
return resolve(address);
}
static URI resolve(EndpointAddress address) throws EndpointAddressResolutionException {
try {
return address.getUri();
} catch (Exception ex) {
throw new EndpointAddressResolutionException(address, ex);
}
}
default List resolveAll(EndpointAddress address, Message message, EndpointAddressResolverMetadata metadata)
throws EndpointAddressResolutionException {
return Collections.singletonList(resolve(address, message, metadata));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy