Package javax.resource.spi.endpoint

Examples of javax.resource.spi.endpoint.MessageEndpoint


    private ServerSessionImpl createServerSessionImpl() throws JMSException {
        MessageActivationSpec activationSpec = activeMQAsfEndpointWorker.endpointActivationKey.getActivationSpec();
        int acknowledge = (activeMQAsfEndpointWorker.transacted) ? Session.SESSION_TRANSACTED : activationSpec.getAcknowledgeModeForSession();
        final ActiveMQSession session = (ActiveMQSession)activeMQAsfEndpointWorker.connection.createSession(activeMQAsfEndpointWorker.transacted, acknowledge);
        MessageEndpoint endpoint;
        try {
            int batchSize = 0;
            if (activationSpec.getEnableBatchBooleanValue()) {
                batchSize = activationSpec.getMaxMessagesPerBatchIntValue();
            }
View Full Code Here


            return null;
        }
    }

    private MessageEndpoint createEndpoint(LocalAndXATransaction txResourceProxy) throws UnavailableException {
        MessageEndpoint endpoint;
        endpoint = activeMQAsfEndpointWorker.endpointFactory.createEndpoint(txResourceProxy);
        MessageEndpointProxy endpointProxy = new MessageEndpointProxy(endpoint);
        return endpointProxy;
    }
View Full Code Here

        public void endpointDeactivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) {
            final EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec;

            final EmailConsumer emailConsumer = consumers.remove(accountInfo.getAddress());
            final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;
            endpoint.release();
        }
View Full Code Here

            final EmailConsumer emailConsumer = consumers.get(to);

            if (emailConsumer == null) throw new Exception("No such account");

            final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;

            endpoint.beforeDelivery(EmailConsumer.class.getMethod("receiveEmail", Properties.class, String.class));
            emailConsumer.receiveEmail(headers, body);
            endpoint.afterDelivery();
        }
View Full Code Here

    }
   
    protected boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer)
        throws JMSException {
        boolean messageReceived = false;
        MessageEndpoint ep = null;
        MessageConsumer mc = null;
        XASession xa = null;
        Session s = null;

        try {       
            xa = (XASession)createSession(getSharedConnection());
            XAResource xar = xa.getXAResource();
            s = xa.getSession();
            mc = s.createConsumer(getDestination());           
            ep = factory.createEndpoint(xar);
           
            Map<Class<?>, Object> mp = new HashMap<Class<?>, Object>();
            mp.put(MessageEndpoint.class, ep);
           
            ENDPOINT_LOCAL.set(mp);
            ep.beforeDelivery(method);               
            messageReceived = doReceiveAndExecute(invoker, s, mc, null);
            ep.afterDelivery();
        } catch (Exception ex) {
            throw new JMSException(ex.getMessage());
        } finally {
            if (ep != null) {
                ep.release();
            }
            JmsUtils.closeMessageConsumer(mc);
            JmsUtils.closeSession(xa);
            JmsUtils.closeSession(s);
        }
View Full Code Here

        public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) {
            EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec;

            EmailConsumer emailConsumer = consumers.remove(accountInfo.getAddress());
            MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;
            endpoint.release();
        }
View Full Code Here

            EmailConsumer emailConsumer = consumers.get(to);

            if (emailConsumer == null) throw new Exception("No such account");

            MessageEndpoint endpoint = (MessageEndpoint) emailConsumer;

            endpoint.beforeDelivery(EmailConsumer.class.getMethod("receiveEmail", Properties.class, String.class));
            emailConsumer.receiveEmail(headers, body);
            endpoint.afterDelivery();
        }
View Full Code Here

        try {

            JobSpec spec = (JobSpec) activationSpec;

            MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
            spec.setEndpoint(endpoint);

            Job job = (Job) endpoint;

            JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
View Full Code Here

        private static Method method = null;

        public void execute(JobExecutionContext execution) throws JobExecutionException {

            MessageEndpoint endpoint = null;

            try {

                JobDataMap jobDataMap = execution.getJobDetail().getJobDataMap();

                Data data = Data.class.cast(jobDataMap.get(Data.class.getName()));

                Job job = data.job;

                endpoint = (MessageEndpoint) job;

                if (null == method) {
                    method = Job.class.getMethod("execute", JobExecutionContext.class);
                }

                endpoint.beforeDelivery(method);

                job.execute(execution);

            } catch (NoSuchMethodException e) {
                throw new IllegalStateException(e);
            } catch (ResourceException e) {
                throw new JobExecutionException(e);
            } catch (Throwable t) {
                throw new JobExecutionException(new Exception(t));
            } finally {

                if (null != endpoint) {
                    try {
                        endpoint.afterDelivery();
                    } catch (ResourceException e) {
                        throw new JobExecutionException(e);
                    }
                }
            }
View Full Code Here

                     return;
                  }
               }
            }

            MessageEndpoint endToUse = endpoint;
            try
            {
               // to avoid a NPE that would happen while the RA is in tearDown
               if (endToUse != null)
               {
                  endToUse.afterDelivery();
               }
            }
            catch (ResourceException e1)
            {
               HornetQRALogger.LOGGER.unableToCallAfterDelivery(e1);
View Full Code Here

TOP

Related Classes of javax.resource.spi.endpoint.MessageEndpoint

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.