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

pl.allegro.tech.hermes.consumers.consumer.sender.resolver.InterpolatingEndpointAddressResolver Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
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.interpolation.InterpolationException;
import pl.allegro.tech.hermes.consumers.consumer.interpolation.UriInterpolator;

import java.net.URI;

public class InterpolatingEndpointAddressResolver implements EndpointAddressResolver {

    private final UriInterpolator interpolator;

    public InterpolatingEndpointAddressResolver(UriInterpolator interpolator) {
        this.interpolator = interpolator;
    }

    @Override
    public URI resolve(EndpointAddress address, Message message, EndpointAddressResolverMetadata metadata)
            throws EndpointAddressResolutionException {
        try {
            return interpolator.interpolate(address, message);
        } catch (InterpolationException ex) {
            throw new EndpointAddressResolutionException(address, ex);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy