use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class Memory method values.
/**
* Returns all values of a Property in the Message order.
*
* @param propName Property Name
* @return List of values
* @throws Exception
*/
public List<Object> values(String propName) throws Exception {
List<Object> list = new ArrayList<Object>(size());
for (int i = 0; i < size(); i++) {
Message message = at(i);
Property property = message.property(propName);
list.add(property.value().toObject());
}
return list;
}
use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class QueueMemory method select.
@Override
public Memory select(String selector) throws Exception {
MessageSelector sel = new MessageSelector(selector);
sel.compile();
Memory child = new HeapMemory(ctx);
for (int i = 0; i < messageStore.size(); i++) {
Message message = at(i);
if (message.isSelected(sel))
child.add(message);
}
return child;
}
use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class QueueMemory method all.
@Override
List<Entry> all() throws Exception {
List<Entry> result = new ArrayList<Entry>();
for (int i = 0; i < messageStore.size(); i++) {
KeyEntry keyEntry = messageStore.get(i);
if (keyEntry.messageIndex != null) {
MessageEntry entry = abstractQueue.getMessageByIndex(keyEntry.messageIndex);
result.add(new Entry(keyEntry.key, entry.getMessage().getJMSTimestamp(), ctx.messageBuilder.wrap(entry.getMessage())));
} else {
Message message = txBookKeeper.get(keyEntry.key);
result.add(new Entry(keyEntry.key, message.timestamp(), message));
}
}
return result;
}
use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class QueueMemory method removeOlderThan.
@Override
public Memory removeOlderThan(long time, boolean executeCallback) throws Exception {
Memory retired = null;
List<KeyEntry> removed = messageStore.removeOlderThan(time);
if (orderBy != null && removed.size() > 0)
lastWindowCloseTime = removed.get(removed.size() - 1).storeTime;
if (executeCallback && retirementCallback != null && removed.size() > 0)
retired = new HeapMemory(ctx);
for (int i = 0; i < removed.size(); i++) {
KeyEntry keyEntry = removed.get(i);
if (keyEntry.messageIndex != null) {
MessageEntry entry = abstractQueue.getMessageByIndex(keyEntry.messageIndex);
txBookKeeper.remove(keyEntry.key, keyEntry);
Message message = ctx.messageBuilder.wrap(entry.getMessage());
removeFromIndexes(keyEntry.key, message);
if (retired != null)
retired.add(message);
}
}
if (retired != null && retired.size() > 0)
retirementCallback.execute(retired);
return this;
}
use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class ManagementProcessor method entityRemoved.
@Override
public void entityRemoved(Entity parent, Entity delEntity) {
if (input.hasChangeCallback()) {
AllPropertyWatchListener watchListener = watchListenerMap.remove(delEntity.getName());
if (watchListener != null)
watchListener.deregister();
}
if (!input.hasRemoveCallback())
return;
Message message = addProperties(ctx.messageBuilder.message().property(ManagementInput.PROP_OPER).set(ManagementInput.VAL_REMOVE).property(ManagementInput.PROP_TIME).set(System.currentTimeMillis()), delEntity);
sendMessage(message);
}
Aggregations