Search in sources :

Example 1 with Receiver

use of com.splunk.Receiver in project camel by apache.

the class StreamDataWriter method createSocket.

@Override
protected Socket createSocket(Service service) throws IOException {
    Index indexObject = null;
    Receiver receiver = null;
    Socket socket = null;
    if (index != null) {
        indexObject = service.getIndexes().get(index);
        if (indexObject == null) {
            throw new RuntimeCamelException(String.format("cannot find index [%s]", index));
        }
        socket = indexObject.attach(args);
    } else {
        receiver = service.getReceiver();
        socket = receiver.attach(args);
    }
    socket.setTcpNoDelay(true);
    LOG.trace(String.format("created a socket on %s", socket.getRemoteSocketAddress()));
    return socket;
}
Also used : Receiver(com.splunk.Receiver) Index(com.splunk.Index) RuntimeCamelException(org.apache.camel.RuntimeCamelException) Socket(java.net.Socket)

Example 2 with Receiver

use of com.splunk.Receiver in project camel by apache.

the class SubmitDataWriter method doWrite.

@Override
protected void doWrite(String event) throws IOException {
    Index index = getIndex();
    if (index != null) {
        index.submit(args, event);
    } else {
        Receiver receiver = endpoint.getService().getReceiver();
        receiver.submit(args, event);
    }
}
Also used : Receiver(com.splunk.Receiver) Index(com.splunk.Index)

Aggregations

Index (com.splunk.Index)2 Receiver (com.splunk.Receiver)2 Socket (java.net.Socket)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1