return new HashSet<ConstraintItem>(selectedItems.values());
}
@Override
public void process(ClusterEvent event) throws Exception {
Cluster cluster = event.getAttribute("ClusterDataCache");
MessageOutput msgSelectionOutput =
event.getAttribute(AttributeName.MESSAGES_SELECTED.toString());
Map<ResourceId, ResourceConfig> resourceMap =
event.getAttribute(AttributeName.RESOURCES.toString());
BestPossibleStateOutput bestPossibleStateOutput =
event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.toString());
if (cluster == null || resourceMap == null || msgSelectionOutput == null
|| bestPossibleStateOutput == null) {
throw new StageException("Missing attributes in event: " + event
+ ". Requires ClusterDataCache|RESOURCES|BEST_POSSIBLE_STATE|MESSAGES_SELECTED");
}
MessageOutput output = new MessageOutput();
// TODO fix it
ClusterConstraints constraint = cluster.getConstraint(ConstraintType.MESSAGE_CONSTRAINT);
Map<String, Integer> throttleCounterMap = new HashMap<String, Integer>();
if (constraint != null) {
// go through all pending messages, they should be counted but not throttled
for (ParticipantId participantId : cluster.getLiveParticipantMap().keySet()) {
Participant liveParticipant = cluster.getLiveParticipantMap().get(participantId);
throttle(throttleCounterMap, constraint, new ArrayList<Message>(liveParticipant
.getMessageMap().values()), false);
}
}