Examples of KeyedDataQueueEntry


Examples of com.ibm.as400.access.KeyedDataQueueEntry

    }

    private Exchange receive(KeyedDataQueue queue, long timeout) throws Exception {
        String key = endpoint.getSearchKey();
        String searchType = endpoint.getSearchType().name();
        KeyedDataQueueEntry entry;
        if (timeout >= 0) {
            int seconds = (int) timeout / 1000;
            log.trace("Reading from data queue: {} with {} seconds timeout", queue.getName(), seconds);
            entry = queue.read(key, seconds, searchType);
        } else {
            log.trace("Reading from data queue: {} with no timeout", queue.getName());
            entry = queue.read(key, -1, searchType);
        }

        Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
        if (entry != null) {
            exchange.getIn().setHeader(Jt400DataQueueEndpoint.SENDER_INFORMATION, entry.getSenderInformation());
            if (endpoint.getFormat() == Format.binary) {
                exchange.getIn().setBody(entry.getData());
                exchange.getIn().setHeader(Jt400DataQueueEndpoint.KEY, entry.getKey());
            } else {
                exchange.getIn().setBody(entry.getString());
                exchange.getIn().setHeader(Jt400DataQueueEndpoint.KEY, entry.getKeyString());
            }

            return exchange;
        }
        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.