Search in sources :

Example 16 with Message

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;
}
Also used : Message(com.swiftmq.impl.streams.comp.message.Message) Property(com.swiftmq.impl.streams.comp.message.Property)

Example 17 with Message

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;
}
Also used : Message(com.swiftmq.impl.streams.comp.message.Message) MessageSelector(com.swiftmq.ms.MessageSelector)

Example 18 with Message

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;
}
Also used : Message(com.swiftmq.impl.streams.comp.message.Message)

Example 19 with Message

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;
}
Also used : Message(com.swiftmq.impl.streams.comp.message.Message)

Example 20 with Message

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);
}
Also used : POMgmtMessage(com.swiftmq.impl.streams.processor.po.POMgmtMessage) Message(com.swiftmq.impl.streams.comp.message.Message)

Aggregations

Message (com.swiftmq.impl.streams.comp.message.Message)21 Property (com.swiftmq.impl.streams.comp.message.Property)4 POMgmtMessage (com.swiftmq.impl.streams.processor.po.POMgmtMessage)3 ManagementInput (com.swiftmq.impl.streams.comp.io.ManagementInput)2 QueueWireTapInput (com.swiftmq.impl.streams.comp.io.QueueWireTapInput)2 MessageSelector (com.swiftmq.ms.MessageSelector)2 Input (com.swiftmq.impl.streams.comp.io.Input)1 HeapMemory (com.swiftmq.impl.streams.comp.memory.HeapMemory)1 Memory (com.swiftmq.impl.streams.comp.memory.Memory)1 MessageImpl (com.swiftmq.jms.MessageImpl)1 QueueImpl (com.swiftmq.jms.QueueImpl)1 BigDecimal (java.math.BigDecimal)1 ResultSet (java.sql.ResultSet)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 Statement (java.sql.Statement)1