class StreamSubscriber implements Subscriber {

    @Override
    public SubscriptionContext subscribeToStream(URL wpsUrl, String stream, DataFilter filter, Geometry g)
    {
        LOGGER.info("Performing request " + StreamingConstants.SUBSCRIBE_PROCESS + " - " + wpsUrl + " for layer " + stream
                + " using data filter [" + filter + "] and spatial filter [" + g + "]");
        InputStream response = getResponseViaPost(wpsUrl, buildRequest(stream, filter, normalize(g)));
        if (response == null)
        {
            return null;
        }

        try
        {
            Configuration cfg = XMLUtilities.readXMLObject(response, Configuration.class);
            // if the URL is null, then this was most likely an error message
            if (cfg == null || cfg.getUrl() == null)
            {
                return null;
            }
            String filterId = cfg.getFilterId();
            String idParam = cfg.getUrl().getRequestParameters().get(0);

            StringBuilder buf = new StringBuilder();
            buf.append(cfg.getUrl().getBase());
            buf.append('?');
            buf.append(idParam);
            buf.append('=');
            buf.append(filterId);
            buf.append('&');
            buf.append(cfg.getUrl().getRequestParameters().get(1));
            buf.append('=');
            int pollInterval = Integer.parseInt(System.getProperty("NRTPollInterval", "5000"));
            buf.append(pollInterval);

            URL url = new URL(buf.toString());
            LOGGER.info("Stream URL for layer " + stream + " is " + url);

            SubscriptionContext context = new SubscriptionContext();
            context.setFilterIdParameterName(idParam);
            context.setStreamId(UUID.fromString(filterId));
            context.setStreamUrl(url);
            context.setPollInterval(pollInterval);
            return context;
        }
        catch (JAXBException | MalformedURLException e)
        {
            LOGGER.error(e.getMessage(), e);
        }

        return null;
    }

    public  StreamSubscriber(ServerProviderRegistry providerRegistry);

}