本文整理了Java中org.wso2.siddhi.core.event.Event.setTimestamp()
方法的一些代码示例,展示了Event.setTimestamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setTimestamp()
方法的具体详情如下:
包路径:org.wso2.siddhi.core.event.Event
类名称:Event
方法名:setTimestamp
暂无
代码示例来源:origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.common
public Event (long timestamp, Object[] data, String streamId){
super.setTimestamp(timestamp);
super.setData(data);
this.streamId = streamId;
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
/**
* resume() method
*/
@Override
public void resume() {
if ("-1".equals(csvConfiguration.getTimestampAttribute())) {
startTimestamp = System.currentTimeMillis();
nextEvent.setTimestamp(startTimestamp);
}
if (log.isDebugEnabled()) {
log.debug("Stop random generator for stream '" + csvConfiguration.getStreamName() + "'");
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
/**
* resume() method
*/
@Override
public void resume() {
/*
* The system timestamp is set to current timestamp to enable the event to have the latest timestamp.
* This timestamp is used to create the notify timer event in the WindowProcessor
* If we use the timestamp at the time of pausing the simulator, it will cause issues when generating the timer
* event because the system timestamp is continously increasing
*/
currentTimestamp = System.currentTimeMillis();
nextEvent.setTimestamp(currentTimestamp);
currentTimestamp += randomSimulationConfig.getTimestampInterval();
if (log.isDebugEnabled()) {
log.debug("Stop random generator for stream '" + randomSimulationConfig.getStreamName() + "'");
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
/**
* resume() method
*/
@Override
public void resume() {
if (null == dbSimulationConfig.getTimestampAttribute()) {
currentTimestamp = System.currentTimeMillis();
nextEvent.setTimestamp(currentTimestamp);
currentTimestamp += dbSimulationConfig.getTimestampInterval();
}
if (log.isDebugEnabled()) {
log.debug("Stop random generator for stream '" + dbSimulationConfig.getStreamName() + "'");
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core
public static Event getEvent(ByteBuffer byteBuffer, String[] attributeTypes) throws UnsupportedEncodingException {
Event event = new Event();
long timeStamp = byteBuffer.getLong();
event.setTimestamp(timeStamp);
event.setData(toObjectArray(byteBuffer, attributeTypes));
return event;
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core
event.setTimestamp(timestamp);
event.setData(eventData);
return event;
代码示例来源:origin: apache/eagle
private void sendPatternInput(InputHandler handler) throws Exception {
// validate one
Event e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + 0, "MSGID-...", "Timestamp", "conn-sss", "op-msg-UPDOWN", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + 0, "MSGID-...", "Timestamp", "conn-sss", "op-msg-nothing", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + 0, "MSGID-...", "Timestamp", "conn-sss", "op-msg-Abort", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
Thread.sleep(61 * 1000);
e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + 11, "MSGID-...", "Timestamp", "conn-sss", "op-msg", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
handler.send(e);
}
代码示例来源:origin: apache/eagle
private void sendInput(InputHandler handler) throws Exception {
int length = 15;
Event[] events = new Event[length];
for (int i = 0; i < length; i++) {
Event e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + i % 4, "MSGID-...", "Timestamp", "conn-sss", "op-msg-Abort", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
events[i] = e;
}
handler.send(events);
Thread.sleep(61 * 1000);
Event e = new Event(12);
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {"facitliy", "SEVERITY_EMERG", "HOSTNAME-" + 11, "MSGID-...", "Timestamp", "conn-sss", "op-msg", "msgId..", "command-...", "name-", "namespace", System.currentTimeMillis()});
handler.send(e);
}
代码示例来源:origin: apache/eagle
private void sendEvent(InputHandler input1, InputHandler input2, long base) throws InterruptedException {
{
Event e = new Event();
e.setTimestamp(base);
e.setData(new Object[] {
"instance-guid-c2a1c926-b590-418e-bf57-41469d7891fa",
base,
"ERROR",
"NullPointException",
"req-id-82dab92c-9e45-4ad8-8793-96e912831f00",
"nova.host",
"NOVA"
});
input1.send(e);
}
{
Event e = new Event();
e.setTimestamp(base);
e.setData(new Object[] {"instance-guid-c2a1c926-b590-418e-bf57-41469d7891fa",
base,
"req-id-82dab92c-9e45-4ad8-8793-96e912831f00",
"boot failure for when try start the given vm!",
"boot-vm-data-center.corp.com"});
input2.send(e);
}
}
代码示例来源:origin: apache/eagle
semp.acquire();
Event e = new Event();
e.setTimestamp(System.currentTimeMillis());
String rhs = "[\"b\", \"d\"]";
e.setData(new Object[] {System.currentTimeMillis(), "a", "a", "hadoop.namenode.namenodeinfo.corruptfiles", "port01", rhs});
logInput.send(e);
e.setTimestamp(System.currentTimeMillis());
String ths = "[\"a\", \"b\", \"c\", \"d\", \"e\"]";
e.setData(new Object[] {System.currentTimeMillis(), "a", "a", "hadoop.namenode.namenodeinfo.corruptfiles", "port01", ths});
代码示例来源:origin: apache/eagle
@Test
public void testStringListSize() throws Exception {
Semaphore semp = new Semaphore(1);
String ql = " define stream log(timestamp long, switchLabel string, port string, message string); " +
" from log select string:listSize(switchLabel) as alertKey insert into output; ";
SiddhiManager manager = new SiddhiManager();
ExecutionPlanRuntime runtime = manager.createExecutionPlanRuntime(ql);
runtime.addCallback("output", new StreamCallback() {
@Override
public void receive(Event[] events) {
EventPrinter.print(events);
Assert.assertTrue(events.length == 1);
Assert.assertTrue(Integer.parseInt(events[0].getData(0).toString()) == 5);
semp.release();
}
});
runtime.start();
InputHandler logInput = runtime.getInputHandler("log");
semp.acquire();
Event e = new Event();
e.setTimestamp(System.currentTimeMillis());
String ths = "[\"a\", \"b\", \"c\", \"d\", \"e\"]";
String rhs = "[\"b\", \"d\"]";
e.setData(new Object[] {System.currentTimeMillis(), ths, "port01", rhs});
logInput.send(e);
semp.acquire();
runtime.shutdown();
}
代码示例来源:origin: apache/eagle
@Test
public void testStringSubtract() throws Exception {
Semaphore semp = new Semaphore(1);
String ql = " define stream log(timestamp long, switchLabel string, port string, message string); " +
" from log select string:subtract(switchLabel, message) as alertKey insert into output; ";
SiddhiManager manager = new SiddhiManager();
ExecutionPlanRuntime runtime = manager.createExecutionPlanRuntime(ql);
runtime.addCallback("output", new StreamCallback() {
@Override
public void receive(Event[] events) {
EventPrinter.print(events);
Assert.assertTrue(events.length == 1);
Assert.assertTrue(events[0].getData(0).toString().equals("a\nc\ne"));
semp.release();
}
});
runtime.start();
InputHandler logInput = runtime.getInputHandler("log");
semp.acquire();
Event e = new Event();
e.setTimestamp(System.currentTimeMillis());
String ths = "[\"a\", \"b\", \"c\", \"d\", \"e\"]";
String rhs = "[\"b\", \"d\"]";
e.setData(new Object[] {System.currentTimeMillis(), ths, "port01", rhs});
logInput.send(e);
semp.acquire();
runtime.shutdown();
}
代码示例来源:origin: apache/eagle
@Test
public void testStrConcat() throws Exception {
String ql = " define stream log(timestamp long, switchLabel string, port string, message string); " +
" from log select timestamp, str:concat(switchLabel, '===', port) as alertKey, message insert into output; ";
SiddhiManager manager = new SiddhiManager();
ExecutionPlanRuntime runtime = manager.createExecutionPlanRuntime(ql);
runtime.addCallback("output", new StreamCallback() {
@Override
public void receive(Event[] events) {
EventPrinter.print(events);
}
});
runtime.start();
InputHandler logInput = runtime.getInputHandler("log");
Event e = new Event();
e.setTimestamp(System.currentTimeMillis());
e.setData(new Object[] {System.currentTimeMillis(), "switch-ra-slc-01", "port01", "log-message...."});
logInput.send(e);
Thread.sleep(1000);
runtime.shutdown();
}
内容来源于网络,如有侵权,请联系作者删除!