@Override public Stream handleMessage(Message message, MessageReceiver context) throws Exception { SplunkLogEvent splunkEvent = buildCommonEventMessagePart(message, context); String body = getMessageBody(message); splunkEvent.addPair("msg_body", context.stripNewlines ? stripNewlines(body) : body); String text = splunkEvent.toString(); Stream stream = new Stream(); ArrayList<StreamEvent> list = new ArrayList<StreamEvent>(); List<String> chunks = chunkData(text, 1024); for (int i = 0; i < chunks.size(); i++) { StreamEvent event = new StreamEvent(); event.setUnbroken("1"); event.setData(chunks.get(i)); event.setStanza(context.stanzaName); // if we are seeing the last chunk, set the "done" element if (i == chunks.size() - 1) event.setDone(" "); list.add(event); } stream.setEvents(list); return stream; }
@Override public Stream handleMessage(Message message, MessageReceiver context) throws Exception { SplunkLogEvent splunkEvent = buildCommonEventMessagePart(message, context); String body = getMessageBody(message); splunkEvent.addPair("msg_body", context.stripNewlines ? stripNewlines(body) : body); String text = splunkEvent.toString(); Stream stream = new Stream(); StreamEvent event = new StreamEvent(); event.setData(text); event.setStanza(context.stanzaName); ArrayList<StreamEvent> list = new ArrayList<StreamEvent>(); list.add(event); stream.setEvents(list); return stream; }
@Override public void transport(String text) { Stream stream = new Stream(); ArrayList<StreamEvent> list = new ArrayList<StreamEvent>(); List<String> chunks = chunkData(text, 1024); for (int i = 0; i < chunks.size(); i++) { StreamEvent event = new StreamEvent(); event.setUnbroken("1"); event.setData(chunks.get(i)); event.setStanza(stanzaName); // if we are seeing the last chunk, set the "done" element if (i == chunks.size() - 1) event.setDone(" "); list.add(event); } stream.setEvents(list); marshallObjectToXML(stream); }