コード例 #1
0
  @Override
  public JmsMessageEndpointManager createListenerContainer(JmsListenerEndpoint endpoint) {
    if (this.destinationResolver != null && this.activationSpecFactory != null) {
      throw new IllegalStateException(
          "Specify either 'activationSpecFactory' or "
              + "'destinationResolver', not both. If you define a dedicated JmsActivationSpecFactory bean, "
              + "specify the custom DestinationResolver there (if possible)");
    }

    JmsMessageEndpointManager instance = createContainerInstance();

    if (this.resourceAdapter != null) {
      instance.setResourceAdapter(this.resourceAdapter);
    }
    if (this.activationSpecFactory != null) {
      instance.setActivationSpecFactory(this.activationSpecFactory);
    }
    if (this.destinationResolver != null) {
      instance.setDestinationResolver(this.destinationResolver);
    }
    if (this.transactionManager != null) {
      instance.setTransactionManager(this.transactionManager);
    }
    if (this.phase != null) {
      instance.setPhase(this.phase);
    }

    instance.setActivationSpecConfig(this);
    endpoint.setupListenerContainer(instance);

    return instance;
  }