Search in sources :

Example 1 with FastPublisher

use of com.datatorrent.stram.stream.FastPublisher in project apex-core by apache.

the class StreamingContainer method deployBufferServerPublisher.

private HashMap.SimpleEntry<String, ComponentContextPair<Stream, StreamContext>> deployBufferServerPublisher(String connIdentifier, StreamCodec<?> streamCodec, long finishedWindowId, int queueCapacity, OperatorDeployInfo.OutputDeployInfo nodi) throws UnknownHostException {
    String sinkIdentifier = "tcp://".concat(nodi.bufferServerHost).concat(":").concat(String.valueOf(nodi.bufferServerPort)).concat("/").concat(connIdentifier);
    StreamContext bssc = new StreamContext(nodi.declaredStreamId);
    bssc.setPortId(nodi.portName);
    bssc.setSourceId(connIdentifier);
    bssc.setSinkId(sinkIdentifier);
    bssc.setFinishedWindowId(finishedWindowId);
    bssc.put(StreamContext.CODEC, streamCodec);
    bssc.put(StreamContext.EVENT_LOOP, eventloop);
    bssc.setBufferServerAddress(InetSocketAddress.createUnresolved(nodi.bufferServerHost, nodi.bufferServerPort));
    bssc.put(StreamContext.BUFFER_SERVER_TOKEN, nodi.bufferServerToken);
    InetAddress inetAddress = bssc.getBufferServerAddress().getAddress();
    if (inetAddress != null && NetUtils.isLocalAddress(inetAddress)) {
        bssc.setBufferServerAddress(new InetSocketAddress(InetAddress.getByName(null), nodi.bufferServerPort));
    }
    Stream publisher = fastPublisherSubscriber ? new FastPublisher(connIdentifier, queueCapacity * 256) : new BufferServerPublisher(connIdentifier, queueCapacity);
    return new HashMap.SimpleEntry<>(sinkIdentifier, new ComponentContextPair<>(publisher, bssc));
}
Also used : BufferServerPublisher(com.datatorrent.stram.stream.BufferServerPublisher) InetSocketAddress(java.net.InetSocketAddress) SimpleEntry(java.util.AbstractMap.SimpleEntry) OiOStream(com.datatorrent.stram.stream.OiOStream) InlineStream(com.datatorrent.stram.stream.InlineStream) MuxStream(com.datatorrent.stram.stream.MuxStream) InetAddress(java.net.InetAddress) FastPublisher(com.datatorrent.stram.stream.FastPublisher)

Aggregations

BufferServerPublisher (com.datatorrent.stram.stream.BufferServerPublisher)1 FastPublisher (com.datatorrent.stram.stream.FastPublisher)1 InlineStream (com.datatorrent.stram.stream.InlineStream)1 MuxStream (com.datatorrent.stram.stream.MuxStream)1 OiOStream (com.datatorrent.stram.stream.OiOStream)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1