Package org.apache.activemq.store.jpa.model

Examples of org.apache.activemq.store.jpa.model.StoredMessage


        try {

            ByteSequence sequence = wireFormat.marshal(message);
            sequence.compact();

            StoredMessage sm = new StoredMessage();
            sm.setDestination(destinationName);
            sm.setId(message.getMessageId().getBrokerSequenceId());
            sm.setMessageId(message.getMessageId().toString());
            sm.setExiration(message.getExpiration());
            sm.setData(sequence.data);

            manager.persist(sm);

        } catch (Throwable e) {
            adapter.rollbackEntityManager(context, manager);
View Full Code Here


    public Message getMessage(MessageId identity) throws IOException {
        Message rc;
        EntityManager manager = adapter.beginEntityManager(null);
        try {
            StoredMessage message = null;
            if (identity.getBrokerSequenceId() != 0) {
                message = manager.find(StoredMessage.class, identity.getBrokerSequenceId());
            } else {
                Query query = manager.createQuery("select m from StoredMessage m where m.messageId=?1");
                query.setParameter(1, identity.toString());
                message = (StoredMessage)query.getSingleResult();
            }

            rc = (Message)wireFormat.unmarshal(new ByteSequence(message.getData()));
        } catch (Throwable e) {
            adapter.rollbackEntityManager(null, manager);
            throw IOExceptionSupport.create(e);
        }
        adapter.commitEntityManager(null, manager);
View Full Code Here

TOP

Related Classes of org.apache.activemq.store.jpa.model.StoredMessage

Copyright © 2018 www.massapicom. 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.