|
[
Permalink
| « Hide
]
Tomas Lukosius added a comment - 19/Aug/10 10:27 AM
Changed assignee and fix version.
If throughput monitor looks after pollable channel then:
.... if (channel instanceof PollableChannel) {
// This channel is pollable - need to calculate messages received
// and average queue size.
// We want to know how many messages were received.
wireTap.setPostReceive(true);
StringBuilder sb = new StringBuilder();
sb.append("select count(PS), count(PR) from pattern [every PS=");
sb.append(windowName).append("(operation=").append(IntegrationOperation.class.getName()).append(".")
.append(IntegrationOperation.POST_SEND).append(") OR every PR=");
sb.append(windowName).append("(operation=").append(IntegrationOperation.class.getName()).append(".")
.append(IntegrationOperation.POST_RECEIVE).append(")]");
sb.append(".win:time_batch(").append(timeSample).append(")");
EsperStatement listenForSourceId = new EsperStatement(sb.toString());
listenForSourceId.setSubscriber(this);
template.addStatement(listenForSourceId);
} else {
StringBuilder sb = new StringBuilder();
sb.append("select count(*) as throughput from ").append(windowName);
sb.append(".win:time_batch(").append(this.timeSample).append(")");
sb.append(" where operation=").append(IntegrationOperation.class.getName()).append(".")
.append(IntegrationOperation.POST_SEND);
EsperStatement listenForSourceId = new EsperStatement(sb.toString());
listenForSourceId.setSubscriber(this);
template.addStatement(listenForSourceId);
} ELP in PollableChannel branch will contain count of sent messages (event from EsperWireTap.postSend) and received (event from EsperWireTap.postReceive) messages. Question 1: Note that in ELP has "win:time_batch(this.timeSample)" that means results are calculated for every time interval which is "this.timeSample" and does not include results from previous interval. For example assume we do have empty pollable channel and during the time "t1" (which is equals this.timeSample) 5 messages where sent to and 2 messages received from that channel. EsperChannelThroughputMonitor will print: Sent throughput of 5, received throughput of 2 on pollable channel - <messageChannel-name>. But for the next time interval "t2" no new messages were sent neither received from the channel - in that case EsperChannelThroughputMonitor will print: Sent throughput of 0, received throughput of 0 on pollable channel - <messageChannel-name>. Question 2: Requirement for PollableChannel is: "...throughput should be measured as messages received and in addition average queue size should be made available." |
|||||||||||||||||||||||||||||||||||||||||||||||||||||