protected List getMessages() throws Exception { QueueSession qs = connector.getQueueSession(); Queue queue = qs.getQueue(endpoint.getEndpointURI().getAddress()); UMOEvent event = (UMOEvent) queue.poll(connector.getQueueTimeout()); if (event != null) { routeMessage(new MuleMessage(event.getTransformedMessage(), event.getMessage())); } return null; }
protected void enqueue(MuleEvent event) throws Exception { if (queue == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Queue not created for service " + name), this); } if (logger.isDebugEnabled()) { logger.debug( MessageFormat.format( "Service {0} putting event on queue {1}: {2}", name, queue.getName(), event)); } queue.put(event); }
protected void enqueue(MuleEvent event) throws Exception { QueueSession session = muleContext.getQueueManager().getQueueSession(); Queue queue = session.getQueue(name); if (queue == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Queue " + name + " not created for service " + name), this); } if (logger.isDebugEnabled()) { logger.debug("Service " + name + " putting event on queue " + name + ": " + event); } queue.put(event); }
public int getQueueSize() { QueueSession session = muleContext.getQueueManager().getQueueSession(); Queue queue = session.getQueue(name); if (queue == null) { logger.warn( new InitialisationException( MessageFactory.createStaticMessage( "Queue " + name + " not created for service " + name), this)); return -1; } return queue.size(); }
protected void doConnect() throws Exception { if (connector.isQueueEvents()) { // Ensure we can create a vm queue QueueSession queueSession = connector.getQueueSession(); Queue q = queueSession.getQueue(endpoint.getEndpointURI().getAddress()); if (logger.isDebugEnabled()) { logger.debug( "Current queue depth for queue: " + endpoint.getEndpointURI().getAddress() + " is: " + q.size()); } } }
protected MuleEvent dequeue() throws Exception { if (queue == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Queue not created for service " + name), this); } if (logger.isDebugEnabled()) { logger.debug( MessageFormat.format( "Service {0} polling queue {1}, timeout = {2}", name, queue.getName(), queueTimeout)); } if (getQueueTimeout() == null) { throw new InitialisationException(CoreMessages.noServiceQueueTimeoutSet(this), this); } else { return (MuleEvent) queue.poll(getQueueTimeout()); } }
public MessageExchange accept(long timeout) throws MessagingException { if (this.closed) { throw new MessagingException("Channel is closed"); } try { QueueSession qs = container.getQueueSession(); Queue queue = qs.getQueue(componentName); MessageExchange me = (MessageExchange) queue.poll(timeout); if (me != null) { handleReceive(me); } return me; } catch (InterruptedException e) { throw new MessagingException(e); } }
/* * (non-Javadoc) * * @see org.mule.umo.UMOEventListener#onEvent(org.mule.umo.UMOEvent) */ public void onEvent(UMOEvent event) throws UMOException { if (connector.isQueueEvents()) { QueueSession queueSession = connector.getQueueSession(); Queue queue = queueSession.getQueue(endpoint.getEndpointURI().getAddress()); try { queue.put(event); } catch (InterruptedException e) { throw new MuleException( CoreMessages.interruptedQueuingEventFor(this.endpoint.getEndpointURI()), e); } } else { UMOMessage msg = new MuleMessage(event.getTransformedMessage(), event.getMessage()); synchronized (lock) { routeMessage(msg); } } }
public int getQueueSize() { if (queue == null) { logger.warn( new InitialisationException( MessageFactory.createStaticMessage("Queue not created for service " + name), this)); return -1; } return queue.size(); }
protected MuleEvent dequeue() throws Exception { if (logger.isDebugEnabled()) { // logger.debug("Service " + name + " polling queue " + name + ", timeout = " + queueTimeout); } if (getQueueTimeout() == null) { throw new InitialisationException(CoreMessages.noServiceQueueTimeoutSet(this), this); } else { return (MuleEvent) queue.poll(getQueueTimeout().intValue()); } }
protected void doStop() throws MuleException { if (queue != null && queue.size() > 0) { try { stopping.whenFalse(null); } catch (InterruptedException e) { // we can ignore this // TODO MULE-863: Why? } } workManager.dispose(); }
public void enqueue(MessageExchange exchange) throws MessagingException { if (!(exchange instanceof MessageExchangeProxy)) { throw new MessagingException("exchange should be created with MessageExchangeFactory"); } MessageExchangeProxy me = (MessageExchangeProxy) exchange; if (me.getSyncState() == MessageExchangeProxy.SYNC_STATE_SYNC_SENT) { synchronized (me) { me.setSyncState(MessageExchangeProxy.SYNC_STATE_SYNC_RECEIVED); me.notify(); } } else { try { QueueSession qs = container.getQueueSession(); Queue queue = qs.getQueue(componentName); queue.put(me); } catch (InterruptedException e) { logger.error(e); } } }