Exemplo n.º 1
0
 /*
  * (non-Javadoc)
  *
  * @see org.mule.umo.provider.UMOConnector#registerListener(org.mule.umo.UMOSession,
  *      org.mule.umo.endpoint.UMOEndpoint)
  */
 public UMOMessageReceiver createReceiver(UMOComponent component, UMOEndpoint endpoint)
     throws Exception {
   if (queueEvents) {
     queueProfile.configureQueue(endpoint.getEndpointURI().getAddress());
   }
   return serviceDescriptor.createMessageReceiver(this, component, endpoint);
 }
Exemplo n.º 2
0
  /**
   * Initialise the service. The service will first create a Mule UMO from the UMODescriptor and
   * then initialise a pool based on the attributes in the UMODescriptor.
   *
   * @throws org.mule.api.lifecycle.InitialisationException if the service fails to initialise
   * @see org.mule.api.UMODescriptor
   */
  protected synchronized void doInitialise() throws InitialisationException {
    MuleConfiguration config = muleContext.getConfiguration();
    if (threadingProfile == null) {
      // TODO MULE-2102 This should be configured in the default template.
      threadingProfile = muleContext.getDefaultComponentThreadingProfile();
    }
    // Create thread pool
    workManager = threadingProfile.createWorkManager(getName());

    if (queueProfile == null) {
      // TODO MULE-2102 This should be configured in the default template.
      queueProfile = ((SedaModel) model).getQueueProfile();
    }

    if (queueTimeout == null) {
      // TODO MULE-2102 This should be configured in the default template.
      setQueueTimeout(new Integer(((SedaModel) model).getQueueTimeout()));
    }

    try {
      if (name == null) {
        throw new InitialisationException(
            MessageFactory.createStaticMessage("Service has no name to identify it"), this);
      }
      // Setup event Queue (used for VM execution).  The queue has the same name as the service.
      queueProfile.configureQueue(name, muleContext.getQueueManager());
      queue = muleContext.getQueueManager().getQueueSession().getQueue(name);
      if (queue == null) {
        throw new InitialisationException(
            MessageFactory.createStaticMessage(
                "Queue " + name + " not created for service " + name),
            this);
      }
    } catch (InitialisationException e) {
      throw e;
    } catch (Throwable e) {
      throw new InitialisationException(
          CoreMessages.objectFailedToInitialise("Service Queue"), e, this);
    }
  }