问:
How do I connect my docker Django instance to my docker mysql instance?
I'm running Docker on Mac High Sierra.  I want to run Docker container to house both my Django instances and MySql instances.  I have the following docker-compose.yml file ...

```<code>version: '3'

services:
  web:
    restart: always
    build: ./web
    ports:           # to access the container from outside
      - "8000:8000"
    env_file: .env
    environment:
      DEBUG: 'true'
    command: /usr/local/bin/gunicorn maps.wsgi:application -w 2 -b :8000

  apache:
    restart: always
    build: ./apache/
    ports:
      - "80:80"
    #volumes:
    #  - web-static:/www/static
    links:
      - web:web

  mysql:
    restart: always
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: 'maps_data'
      # So you don't have to use root, but you can if you like
      MYSQL_USER: 'chicommons'
      # You can use whatever password you like
      MYSQL_PASSWORD: 'password'
      # Password for root access
      MYSQL_ROOT_PASSWORD: 'password'
    ports:
      - "3406:3406"
    volumes:
      - my-db:/var/lib/mysql

volumes:
  my-db:
</code>```

The ".env" file I set up looks like this ...

```<code>DB_NAME=maps_data
DB_USER=chicommons
DB_PASS=password
DB_SERVICE=mysql
DB_PORT=3406
</code>```

In my web (Django) instance, I have set my settings.py db thusly ...

```<code>DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ['DB_NAME'],
        'USER': os.environ['DB_USER'],
        'PASSWORD': os.environ['DB_PASS'],
        'HOST': os.environ['DB_SERVICE'],
        'PORT': os.environ['DB_PORT']
    }
}
</code>```

However, when I run "docker-compose up," I get the following errors complaining about not being able to connect to the database ...

```<code>web_1     | Traceback (most recent call last):
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
web_1     |     self.connection = self.get_new_connection(conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 236, in get_new_connection
web_1     |     return Database.connect(**conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
web_1     |     return Connection(*args, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
web_1     |     super(Connection, self).__init__(*args, **kwargs2)
web_1     | MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'mysql' (115)")
web_1     |
web_1     | The above exception was the direct cause of the following exception:
web_1     |
web_1     | Traceback (most recent call last):
web_1     |   File "manage.py", line 21, in <module>
web_1     |     main()
web_1     |   File "manage.py", line 17, in main
web_1     |     execute_from_command_line(sys.argv)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
web_1     |     utility.execute()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 365, in execute
web_1     |     self.fetch_command(subcommand).run_from_argv(self.argv)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
web_1     |     self.execute(*args, **cmd_options)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 332, in execute
web_1     |     self.check()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in check
web_1     |     include_deployment_checks=include_deployment_checks,
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 351, in _run_checks
web_1     |     return checks.run_checks(**kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 73, in run_checks
web_1     |     new_errors = check(app_configs=app_configs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/checks/model_checks.py", line 27, in check_all_models
web_1     |     errors.extend(model.check(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 1200, in check
web_1     |     errors.extend(cls._check_fields(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 1272, in _check_fields
web_1     |     errors.extend(field.check(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 894, in check
web_1     |     errors = super().check(**kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 206, in check
web_1     |     errors.extend(self._check_backend_specific_checks(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 303, in _check_backend_specific_checks
web_1     |     return connections[db].validation.check_field(self, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/validation.py", line 21, in check_field
web_1     |     field_type = field.db_type(self.connection)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 648, in db_type
web_1     |     return connection.data_types[self.get_internal_type()] % data
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 133, in data_types
web_1     |     if self.features.supports_microsecond_precision:
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/features.py", line 65, in supports_microsecond_precision
web_1     |     return self.connection.mysql_version >= (5, 6, 4)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 345, in mysql_version
web_1     |     with self.temporary_connection() as cursor:
web_1     |   File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
web_1     |     return next(self.gen)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 576, in temporary_connection
web_1     |     cursor = self.cursor()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 255, in cursor
web_1     |     return self._cursor()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 232, in _cursor
web_1     |     self.ensure_connection()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
web_1     |     raise dj_exc_value.with_traceback(traceback) from exc_value
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
web_1     |     self.connection = self.get_new_connection(conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 236, in get_new_connection
web_1     |     return Database.connect(**conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
web_1     |     return Connection(*args, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
web_1     |     super(Connection, self).__init__(*args, **kwargs2)
web_1     | django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'mysql' (115)")
</code>```

What's going on?  How do I get my Django web docker instance to connect to my MySql docker instance?

答:
Maybe port mistake</p>

```<code>version: '3'

services:
  web:
    ...
    links:  # <-- add this
      - mysql # <-- add this

  apache:
    ...

  mysql:
    ...
    ports:  # <-- add this
      - "3406:3306" # <-- change myslq port inside is 3306 not 3406

volumes:
  my-db:
</code>```

Body:
I'm running Docker on Mac High Sierra.  I want to run Docker container to house both my Django instances and MySql instances.  I have the following docker-compose.yml file ...

version: '3'

services:
  web:
    restart: always
    build: ./web
    ports:           # to access the container from outside
      - "8000:8000"
    env_file: .env
    environment:
      DEBUG: 'true'
    command: /usr/local/bin/gunicorn maps.wsgi:application -w 2 -b :8000

  apache:
    restart: always
    build: ./apache/
    ports:
      - "80:80"
    #volumes:
    #  - web-static:/www/static
    links:
      - web:web

  mysql:
    restart: always
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: 'maps_data'
      # So you don't have to use root, but you can if you like
      MYSQL_USER: 'chicommons'
      # You can use whatever password you like
      MYSQL_PASSWORD: 'password'
      # Password for root access
      MYSQL_ROOT_PASSWORD: 'password'
    ports:
      - "3406:3406"
    volumes:
      - my-db:/var/lib/mysql

volumes:
  my-db:

The ".env" file I set up looks like this ...

DB_NAME=maps_data
DB_USER=chicommons
DB_PASS=password
DB_SERVICE=mysql
DB_PORT=3406

In my web (Django) instance, I have set my settings.py db thusly ...

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ['DB_NAME'],
        'USER': os.environ['DB_USER'],
        'PASSWORD': os.environ['DB_PASS'],
        'HOST': os.environ['DB_SERVICE'],
        'PORT': os.environ['DB_PORT']
    }
}

However, when I run "docker-compose up," I get the following errors complaining about not being able to connect to the database ...

web_1     | Traceback (most recent call last):
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
web_1     |     self.connection = self.get_new_connection(conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 236, in get_new_connection
web_1     |     return Database.connect(**conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
web_1     |     return Connection(*args, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
web_1     |     super(Connection, self).__init__(*args, **kwargs2)
web_1     | MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'mysql' (115)")
web_1     |
web_1     | The above exception was the direct cause of the following exception:
web_1     |
web_1     | Traceback (most recent call last):
web_1     |   File "manage.py", line 21, in <module>
web_1     |     main()
web_1     |   File "manage.py", line 17, in main
web_1     |     execute_from_command_line(sys.argv)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
web_1     |     utility.execute()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 365, in execute
web_1     |     self.fetch_command(subcommand).run_from_argv(self.argv)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
web_1     |     self.execute(*args, **cmd_options)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 332, in execute
web_1     |     self.check()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in check
web_1     |     include_deployment_checks=include_deployment_checks,
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 351, in _run_checks
web_1     |     return checks.run_checks(**kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/checks/registry.py", line 73, in run_checks
web_1     |     new_errors = check(app_configs=app_configs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/core/checks/model_checks.py", line 27, in check_all_models
web_1     |     errors.extend(model.check(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 1200, in check
web_1     |     errors.extend(cls._check_fields(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 1272, in _check_fields
web_1     |     errors.extend(field.check(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 894, in check
web_1     |     errors = super().check(**kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 206, in check
web_1     |     errors.extend(self._check_backend_specific_checks(**kwargs))
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 303, in _check_backend_specific_checks
web_1     |     return connections[db].validation.check_field(self, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/validation.py", line 21, in check_field
web_1     |     field_type = field.db_type(self.connection)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 648, in db_type
web_1     |     return connection.data_types[self.get_internal_type()] % data
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 133, in data_types
web_1     |     if self.features.supports_microsecond_precision:
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/features.py", line 65, in supports_microsecond_precision
web_1     |     return self.connection.mysql_version >= (5, 6, 4)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/utils/functional.py", line 36, in __get__
web_1     |     res = instance.__dict__[self.name] = self.func(instance)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 345, in mysql_version
web_1     |     with self.temporary_connection() as cursor:
web_1     |   File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
web_1     |     return next(self.gen)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 576, in temporary_connection
web_1     |     cursor = self.cursor()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 255, in cursor
web_1     |     return self._cursor()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 232, in _cursor
web_1     |     self.ensure_connection()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
web_1     |     raise dj_exc_value.with_traceback(traceback) from exc_value
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
web_1     |     self.connect()
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
web_1     |     self.connection = self.get_new_connection(conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 236, in get_new_connection
web_1     |     return Database.connect(**conn_params)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
web_1     |     return Connection(*args, **kwargs)
web_1     |   File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
web_1     |     super(Connection, self).__init__(*args, **kwargs2)
web_1     | django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'mysql' (115)")

What's going on?  How do I get my Django web docker instance to connect to my MySql docker instance?

Body:
Maybe port mistake

version: '3'

services:
  web:
    ...
    links:  # <-- add this
      - mysql # <-- add this

  apache:
    ...

  mysql:
    ...
    ports:  # <-- add this
      - "3406:3306" # <-- change myslq port inside is 3306 not 3406

volumes:
  my-db:


来源: stackexchange

问:
Python logging before you run logging.basicConfig?
It appears that if you invoke logging.info() BEFORE you run logging.basicConfig, the logging.basicConfig call doesn't have any effect. In fact, no logging occurs.

Where is this behavior documented? I don't really understand.

答:
A cleaner version of the answer given by @paul-kremer is:

```<code>while len(logging.root.handlers):
    logging.root.removeHandler(logging.root.handlers[-1])
</code>```

Note: it is generally safe to assume logging.root.handlers will always be a list (see: https://github.com/python/cpython/blob/cebe9ee988837b292f2c571e194ed11e7cd4abbb/Lib/logging/init.py#L1253)

ContentLicense: CC BY-SA 4.0

Body:
A cleaner version of the answer given by @paul-kremer is:

while len(logging.root.handlers):
    logging.root.removeHandler(logging.root.handlers[-1])

Note: it is generally safe to assume logging.root.handlers will always be a list (see: https://github.com/python/cpython/blob/cebe9ee988837b292f2c571e194ed11e7cd4abbb/Lib/logging/init.py#L1253)


问:
How to store original message into JMS Queue instead of org.springframework.messaging.MessageDeliveryException form
I am using Spring Integration for the first time

Scenario:

Read message from source JMS Queue, then push into channel consumed by destination JMS Queue. With a wrong destination Jndi name, retry mechanism kicks in.

After retry exhausts, message pushed into exception JMS Queue.

All queues are in my local Weblogic 12c. The application is a Spring Boot 2.1.10.RELEASE + Spring Integration 5.1.9.RELEASE

When the destination JMS Queue's Jndi is correct then the message is send successfully. This is working, and I can see the message because I set extract payload to true.

Question:

I can see the message in the exception queue, but it is of the form org.springframework.messaging.MessageDeliveryException that is not viewable like in the point 4 above. Is it possible to store the original message in the exception queue instead of the org.springframework.messaging.MessageDeliveryException form?

How can I achieve this with the code below?

Code: [Updated soln]

```<code>@Configuration
@EnableRetry
@EnableIntegration
@Slf4j
public class JmsRoutingConfig {
    @Bean(name = "executor")
    ThreadPoolTaskExecutor executor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        ...
        return threadPoolTaskExecutor;
    }

    public RequestHandlerRetryAdvice retryAdvice() {
        SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
        retryPolicy.setMaxAttempts(3);

        ExponentialBackOffPolicy exponentialBackOff = new ExponentialBackOffPolicy();
        exponentialBackOff.setInitialInterval(5000);
        exponentialBackOff.setMultiplier(2);
        exponentialBackOff.setMaxInterval(30 * 1000);

        RequestHandlerRetryAdvice retryAdvice = new RequestHandlerRetryAdvice();
        RetryTemplate retryTemplate = new RetryTemplate();
        retryTemplate.setBackOffPolicy(exponentialBackOff);
        retryTemplate.setRetryPolicy(retryPolicy);

        RecoveryCallback<Object> recoveryCallBack = new ErrorMessageSendingRecoverer(exceptionQueueChannel());
        retryAdvice.setRecoveryCallback(recoveryCallBack);
        retryAdvice.setRetryTemplate(retryTemplate);
        return retryAdvice;
    }

    @Bean(name = "exceptionQueueChannel")
    public PublishSubscribeChannel exceptionQueueChannel() {
       return new PublishSubscribeChannel();
    }

    @Bean(name = "errorChannel")
    public PublishSubscribeChannel errorChannel() {
        return new PublishSubscribeChannel();
    }

    @Bean
    public IntegrationFlow errorHandlingFlow() {
        return IntegrationFlows.from(errorChannel()).transform("payload.failedMessage").routeByException(r -> r.advice(retryAdvice())).get();
    }

    @Bean
    public IntegrationFlow exceptionHandlingFlow(@Qualifier("exceptionJmsTemplate") JmsTemplate exceptionJmsTemplate) {
    return IntegrationFlows.from(exceptionQueueChannel()).transform("payload.failedMessage").handle(Jms.outboundAdapter(exceptionJmsTemplate).extractPayload(true).get())
            .get();
    }

    @Bean(name = "multiSubcriptionChannel")
    public PublishSubscribeChannel multiSubcriptionChannel(@Qualifier("executor") ThreadPoolTaskExecutor executor) {
        return new PublishSubscribeChannel(executor);
    }

    @Bean(name = "headerValueRouter")
    public HeaderValueRouter headerValueRouter(@Qualifier("multiSubcriptionChannel") PublishSubscribeChannel multiSubcriptionChannel) {
        multiSubcriptionChannel.subscribe(Jms.outboundAdapter(getTargetJmsTemplate()).extractPayload(true).get());
        HeaderValueRouter router = new HeaderValueRouter("jms_correlationId");
        router.setChannelMapping("77", multiSubcriptionChannel.getBeanName());
        return router;
    }

    @Bean
    public IntegrationFlow inFlow(@Qualifier("headerValueRouter") HeaderValueRouter headerValueRouter) {
        return IntegrationFlows.from(jmsInboundChannel()).route(headerValueRouter).get();
    }

    @Bean(name = "listenerErrorChannel")
    public PublishSubscribeChannel listenerErrorChannel() {
        return new PublishSubscribeChannel();
    }

    @Bean
    public IntegrationFlow listenerErrorHandlingFlow() {
        return IntegrationFlows.from(listenerErrorChannel())
                .handle(message -> log.error("LISTENER error (Headers): [{}], (Payload): [{}]",
                        ((MessagingException) message.getPayload()).getFailedMessage().getHeaders(),
                        ((MessagingException) message.getPayload()).getFailedMessage().getPayload())).get();
    }

    @Bean(name = "jmsInboundChannel")
    public JmsMessageDrivenEndpoint jmsInboundChannel() {

    return Jms.messageDrivenChannelAdapter(routingCachingJmsConnectionFactory()).
            configureListenerContainer(
            defaultMessageListenerContainerJmsListenerContainerSpec ->
            defaultMessageListenerContainerJmsListenerContainerSpec
                    .destinationResolver(routingJmsDestinationResolver()).acceptMessagesWhileStopping(false)
                    .sessionTransacted(true).sessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE)
                    .concurrency(routingSourceJmsLowerUpperConcurrentThreadCount).concurrentConsumers(3).maxConcurrentConsumers(3))
            .errorChannel(listenerErrorChannel()).shutdownContainerOnStop(false)
            .destination(routingSourceJmsQueue).autoStartup(true)
            .get();
    }
...
}
</code>```

Logs:

```15:28:20.839 [DefaultMessageListenerContainer-3] DEBUG o.s.j.l.DefaultMessageListenerContainer - Received message of type [class weblogic.jms.common.TextMessageImpl] from consumer [weblogic.jms.client.WLConsumerImpl@12af28a8] of session [Cached JMS Session: weblogic.jms.client.WLSessionImpl@4e918fd1]
15:28:20.841 [DefaultMessageListenerContainer-3] DEBUG o.s.i.j.ChannelPublishingJmsMessageListener - converted JMS Message [TextMessage[ID:<322457.1582057700831.0>, WWW]] to integration Message payload [WWW]
15:28:20.845 [DefaultMessageListenerContainer-3] DEBUG o.s.i.channel.DirectChannel - preSend on channel 'inFlow.channel#0', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.846 [DefaultMessageListenerContainer-3] DEBUG o.s.i.router.HeaderValueRouter - headerValueRouter received message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.846 [DefaultMessageListenerContainer-3] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'multiSubcriptionChannel', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.848 [executor-1] DEBUG o.s.i.jms.JmsSendingMessageHandler - org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11 received message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.849 [DefaultMessageListenerContainer-3] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'multiSubcriptionChannel', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.850 [DefaultMessageListenerContainer-3] DEBUG o.s.i.channel.DirectChannel - postSend (sent=true) on channel 'inFlow.channel#0', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.864 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Executing callback on JMS Session: weblogic.jms.client.WLSessionImpl@24067d07
15:28:20.865 [executor-1] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc/NON_EXISTING_QUEUE]
15:28:20.903 [executor-1] DEBUG o.s.j.s.d.JndiDestinationResolver - Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI
javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc'
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at weblogic.jndi.internal.ServerNamingNode_1034_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:423)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at org.springframework.jndi.JndiTemplate.lambda$lookup$0(JndiTemplate.java:157)
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:92)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:157)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:96)
    at org.springframework.jms.support.destination.JndiDestinationResolver.resolveDestinationName(JndiDestinationResolver.java:114)
    at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:115)
    at org.springframework.jms.core.JmsTemplate.lambda$send$3(JmsTemplate.java:585)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:504)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:691)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:671)
    at org.springframework.integration.jms.JmsSendingMessageHandler.send(JmsSendingMessageHandler.java:219)
    at org.springframework.integration.jms.JmsSendingMessageHandler.handleMessageInternal(JmsSendingMessageHandler.java:184)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:176)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:224)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.access$000(BroadcastingDispatcher.java:56)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher$1.run(BroadcastingDispatcher.java:204)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1180)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:270)
    ...
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:523)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
15:28:20.909 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:20.915 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=0
15:28:20.916 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:20.917 [executor-1] DEBUG o.s.r.b.ExponentialBackOffPolicy - Sleeping for 5000
15:28:25.918 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=1
15:28:25.918 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=1
15:28:25.919 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:25.919 [executor-1] DEBUG o.s.r.b.ExponentialBackOffPolicy - Sleeping for 10000
15:28:35.919 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=2
15:28:35.919 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=2
15:28:35.920 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:35.920 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=3
15:28:35.920 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry failed last attempt: count=3
15:28:35.921 [executor-1] DEBUG o.s.i.h.a.ErrorMessageSendingRecoverer - Sending ErrorMessage: failedMessage: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined.
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:198)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:169)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.cloneAndExecute(AbstractRequestHandlerAdvice.java:93)
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.lambda$doInvoke$1(RequestHandlerRetryAdvice.java:82)
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:211)
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.doInvoke(RequestHandlerRetryAdvice.java:82)
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:70)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
    at com.sun.proxy.$Proxy93.handleMessage(Unknown Source)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:224)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:180)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
    at org.springframework.integration.channel.MessagePublishingErrorHandler.handleError(MessagePublishingErrorHandler.java:95)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
15:28:35.921 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'exceptionQueueChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.921 [executor-1] DEBUG o.s.i.jms.JmsSendingMessageHandler - org.springframework.integration.jms.JmsSendingMessageHandler@38b61501 received message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.923 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Executing callback on JMS Session: weblogic.jms.client.WLSessionImpl@e0750f9
15:28:35.924 [executor-1] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc/JMSExceptionQueue]
15:28:35.926 [executor-1] DEBUG o.s.j.s.d.JndiDestinationResolver - Located object with JNDI name [jdbc/JMSExceptionQueue]
15:28:35.944 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Sending created message: ObjectMessage[null,org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]]
15:28:35.955 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'exceptionQueueChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.955 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
```

答:
Just like you have in your logging handler:

```<code>@Bean
public IntegrationFlow listenerErrorHandlingFlow() {
    return IntegrationFlows.from(listenerErrorChannel())
            .handle(message -> log.error("LISTENER error (Headers): [{}], (Payload): [{}]",
                    ((MessagingException) message.getPayload()).getFailedMessage().getHeaders(),
                    ((MessagingException) message.getPayload()).getFailedMessage().getPayload())).get();
}
</code>```

You need to add a transformer to the error flow to transform the message by extracting the failedMessage from the exception.

```<code>.transform("payload.failedMessage")
.handle(Jms...)
.get();
</code>```

Body:
I am using Spring Integration for the first time

Scenario:

Read message from source JMS Queue, then push into channel consumed by destination JMS Queue. With a wrong destination Jndi name, retry mechanism kicks in.

After retry exhausts, message pushed into exception JMS Queue.

All queues are in my local Weblogic 12c. The application is a Spring Boot 2.1.10.RELEASE + Spring Integration 5.1.9.RELEASE

When the destination JMS Queue's Jndi is correct then the message is send successfully. This is working, and I can see the message because I set extract payload to true.

Question:

I can see the message in the exception queue, but it is of the form org.springframework.messaging.MessageDeliveryException that is not viewable like in the point 4 above. Is it possible to store the original message in the exception queue instead of the org.springframework.messaging.MessageDeliveryException form?

How can I achieve this with the code below?

Code: [Updated soln]

@Configuration
@EnableRetry
@EnableIntegration
@Slf4j
public class JmsRoutingConfig {
    @Bean(name = "executor")
    ThreadPoolTaskExecutor executor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        ...
        return threadPoolTaskExecutor;
    }

    public RequestHandlerRetryAdvice retryAdvice() {
        SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
        retryPolicy.setMaxAttempts(3);

        ExponentialBackOffPolicy exponentialBackOff = new ExponentialBackOffPolicy();
        exponentialBackOff.setInitialInterval(5000);
        exponentialBackOff.setMultiplier(2);
        exponentialBackOff.setMaxInterval(30 * 1000);

        RequestHandlerRetryAdvice retryAdvice = new RequestHandlerRetryAdvice();
        RetryTemplate retryTemplate = new RetryTemplate();
        retryTemplate.setBackOffPolicy(exponentialBackOff);
        retryTemplate.setRetryPolicy(retryPolicy);

        RecoveryCallback<Object> recoveryCallBack = new ErrorMessageSendingRecoverer(exceptionQueueChannel());
        retryAdvice.setRecoveryCallback(recoveryCallBack);
        retryAdvice.setRetryTemplate(retryTemplate);
        return retryAdvice;
    }

    @Bean(name = "exceptionQueueChannel")
    public PublishSubscribeChannel exceptionQueueChannel() {
       return new PublishSubscribeChannel();
    }

    @Bean(name = "errorChannel")
    public PublishSubscribeChannel errorChannel() {
        return new PublishSubscribeChannel();
    }

    @Bean
    public IntegrationFlow errorHandlingFlow() {
        return IntegrationFlows.from(errorChannel()).transform("payload.failedMessage").routeByException(r -> r.advice(retryAdvice())).get();
    }

    @Bean
    public IntegrationFlow exceptionHandlingFlow(@Qualifier("exceptionJmsTemplate") JmsTemplate exceptionJmsTemplate) {
    return IntegrationFlows.from(exceptionQueueChannel()).transform("payload.failedMessage").handle(Jms.outboundAdapter(exceptionJmsTemplate).extractPayload(true).get())
            .get();
    }

    @Bean(name = "multiSubcriptionChannel")
    public PublishSubscribeChannel multiSubcriptionChannel(@Qualifier("executor") ThreadPoolTaskExecutor executor) {
        return new PublishSubscribeChannel(executor);
    }

    @Bean(name = "headerValueRouter")
    public HeaderValueRouter headerValueRouter(@Qualifier("multiSubcriptionChannel") PublishSubscribeChannel multiSubcriptionChannel) {
        multiSubcriptionChannel.subscribe(Jms.outboundAdapter(getTargetJmsTemplate()).extractPayload(true).get());
        HeaderValueRouter router = new HeaderValueRouter("jms_correlationId");
        router.setChannelMapping("77", multiSubcriptionChannel.getBeanName());
        return router;
    }

    @Bean
    public IntegrationFlow inFlow(@Qualifier("headerValueRouter") HeaderValueRouter headerValueRouter) {
        return IntegrationFlows.from(jmsInboundChannel()).route(headerValueRouter).get();
    }

    @Bean(name = "listenerErrorChannel")
    public PublishSubscribeChannel listenerErrorChannel() {
        return new PublishSubscribeChannel();
    }

    @Bean
    public IntegrationFlow listenerErrorHandlingFlow() {
        return IntegrationFlows.from(listenerErrorChannel())
                .handle(message -> log.error("LISTENER error (Headers): [{}], (Payload): [{}]",
                        ((MessagingException) message.getPayload()).getFailedMessage().getHeaders(),
                        ((MessagingException) message.getPayload()).getFailedMessage().getPayload())).get();
    }

    @Bean(name = "jmsInboundChannel")
    public JmsMessageDrivenEndpoint jmsInboundChannel() {

    return Jms.messageDrivenChannelAdapter(routingCachingJmsConnectionFactory()).
            configureListenerContainer(
            defaultMessageListenerContainerJmsListenerContainerSpec ->
            defaultMessageListenerContainerJmsListenerContainerSpec
                    .destinationResolver(routingJmsDestinationResolver()).acceptMessagesWhileStopping(false)
                    .sessionTransacted(true).sessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE)
                    .concurrency(routingSourceJmsLowerUpperConcurrentThreadCount).concurrentConsumers(3).maxConcurrentConsumers(3))
            .errorChannel(listenerErrorChannel()).shutdownContainerOnStop(false)
            .destination(routingSourceJmsQueue).autoStartup(true)
            .get();
    }
...
}

Logs:

15:28:20.839 [DefaultMessageListenerContainer-3] DEBUG o.s.j.l.DefaultMessageListenerContainer - Received message of type [class weblogic.jms.common.TextMessageImpl] from consumer [weblogic.jms.client.WLConsumerImpl@12af28a8] of session [Cached JMS Session: weblogic.jms.client.WLSessionImpl@4e918fd1]
15:28:20.841 [DefaultMessageListenerContainer-3] DEBUG o.s.i.j.ChannelPublishingJmsMessageListener - converted JMS Message [TextMessage[ID:<322457.1582057700831.0>, WWW]] to integration Message payload [WWW]
15:28:20.845 [DefaultMessageListenerContainer-3] DEBUG o.s.i.channel.DirectChannel - preSend on channel 'inFlow.channel#0', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.846 [DefaultMessageListenerContainer-3] DEBUG o.s.i.router.HeaderValueRouter - headerValueRouter received message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.846 [DefaultMessageListenerContainer-3] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'multiSubcriptionChannel', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.848 [executor-1] DEBUG o.s.i.jms.JmsSendingMessageHandler - org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11 received message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.849 [DefaultMessageListenerContainer-3] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'multiSubcriptionChannel', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.850 [DefaultMessageListenerContainer-3] DEBUG o.s.i.channel.DirectChannel - postSend (sent=true) on channel 'inFlow.channel#0', message: GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}]
15:28:20.864 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Executing callback on JMS Session: weblogic.jms.client.WLSessionImpl@24067d07
15:28:20.865 [executor-1] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc/NON_EXISTING_QUEUE]
15:28:20.903 [executor-1] DEBUG o.s.j.s.d.JndiDestinationResolver - Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI
javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc'
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at weblogic.jndi.internal.ServerNamingNode_1034_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:423)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at org.springframework.jndi.JndiTemplate.lambda$lookup$0(JndiTemplate.java:157)
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:92)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:157)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:96)
    at org.springframework.jms.support.destination.JndiDestinationResolver.resolveDestinationName(JndiDestinationResolver.java:114)
    at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:115)
    at org.springframework.jms.core.JmsTemplate.lambda$send$3(JmsTemplate.java:585)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:504)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:691)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:671)
    at org.springframework.integration.jms.JmsSendingMessageHandler.send(JmsSendingMessageHandler.java:219)
    at org.springframework.integration.jms.JmsSendingMessageHandler.handleMessageInternal(JmsSendingMessageHandler.java:184)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:176)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:224)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.access$000(BroadcastingDispatcher.java:56)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher$1.run(BroadcastingDispatcher.java:204)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1180)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:270)
    ...
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:523)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
15:28:20.909 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:20.915 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=0
15:28:20.916 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:20.917 [executor-1] DEBUG o.s.r.b.ExponentialBackOffPolicy - Sleeping for 5000
15:28:25.918 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=1
15:28:25.918 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=1
15:28:25.919 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:25.919 [executor-1] DEBUG o.s.r.b.ExponentialBackOffPolicy - Sleeping for 10000
15:28:35.919 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=2
15:28:35.919 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry: count=2
15:28:35.920 [executor-1] DEBUG o.s.i.r.ErrorMessageExceptionTypeRouter - errorHandlingFlow.router#0 received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
15:28:35.920 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Checking for rethrow: count=3
15:28:35.920 [executor-1] DEBUG o.s.retry.support.RetryTemplate - Retry failed last attempt: count=3
15:28:35.921 [executor-1] DEBUG o.s.i.h.a.ErrorMessageSendingRecoverer - Sending ErrorMessage: failedMessage: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]
org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined.
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:198)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:169)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.cloneAndExecute(AbstractRequestHandlerAdvice.java:93)
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.lambda$doInvoke$1(RequestHandlerRetryAdvice.java:82)
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:211)
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.doInvoke(RequestHandlerRetryAdvice.java:82)
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:70)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
    at com.sun.proxy.$Proxy93.handleMessage(Unknown Source)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:224)
    at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:180)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
    at org.springframework.integration.channel.MessagePublishingErrorHandler.handleError(MessagePublishingErrorHandler.java:95)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
15:28:35.921 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - preSend on channel 'exceptionQueueChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.921 [executor-1] DEBUG o.s.i.jms.JmsSendingMessageHandler - org.springframework.integration.jms.JmsSendingMessageHandler@38b61501 received message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.923 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Executing callback on JMS Session: weblogic.jms.client.WLSessionImpl@e0750f9
15:28:35.924 [executor-1] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc/JMSExceptionQueue]
15:28:35.926 [executor-1] DEBUG o.s.j.s.d.JndiDestinationResolver - Located object with JNDI name [jdbc/JMSExceptionQueue]
15:28:35.944 [executor-1] DEBUG o.s.jms.core.JmsTemplate - Sending created message: ObjectMessage[null,org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]]
15:28:35.955 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'exceptionQueueChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: No channel resolved by router 'errorHandlingFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0' and no 'defaultOutputChannel' defined., failedMessage=ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}], headers={id=7d86b3e2-287f-e867-af54-0bb6744c2853, timestamp=1582057715920}]
15:28:35.955 [executor-1] DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler@f9d2b11]; nested exception is org.springframework.jms.support.destination.DestinationResolutionException: Destination [jdbc/NON_EXISTING_QUEUE] not found in JNDI; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'jdbc.NON_EXISTING_QUEUE'. Resolved 'jdbc']; remaining name 'NON_EXISTING_QUEUE', failedMessage=GenericMessage [payload=WWW, headers={jms_redelivered=false, JMSXDeliveryCount=1, jms_destination=SystemModule!SourceQueue, jms_correlationId=77, id=ca2e8e8f-9b15-fbb2-4940-8b72c601c105, priority=4, jms_timestamp=1582057700831, jms_messageId=ID:<322457.1582057700831.0>, timestamp=1582057700845}], headers={id=7097a41a-6def-cff7-6b65-6ec42cf0ba26, timestamp=1582057700909}]

Body:
Just like you have in your logging handler:

@Bean
public IntegrationFlow listenerErrorHandlingFlow() {
    return IntegrationFlows.from(listenerErrorChannel())
            .handle(message -> log.error("LISTENER error (Headers): [{}], (Payload): [{}]",
                    ((MessagingException) message.getPayload()).getFailedMessage().getHeaders(),
                    ((MessagingException) message.getPayload()).getFailedMessage().getPayload())).get();
}

You need to add a transformer to the error flow to transform the message by extracting the failedMessage from the exception.

.transform("payload.failedMessage")
.handle(Jms...)
.get();


问:
Show number of edges between two nodes on plot
I am making a network graph from a dataframe, as shown below

```<code>import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt

data = {'source': ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'],
        'target': ['B', 'B', 'C', 'D', 'E', 'B', 'C', 'E', 'F', 'C']}
df = pd.DataFrame(data=data)

G = nx.from_pandas_edgelist(df, source='source', create_using=nx.Graph(), target='target')
pos = nx.spring_layout(G)
nx.draw_networkx(G, pos, with_labels=False, node_color='#1f0ee3', node_size=150,
                 edge_color='r', width=1, alpha=0.6, style='dashed',
                 font_color='k', font_size=15, font_weight=20)
# Offset for node labels
offset = 0.15
pos_labels = {}
keys = pos.keys()
for key in keys:
    x, y = pos[key]
    pos_labels[key] = (x, y + offset)
nx.draw_networkx_labels(G, pos=pos_labels, fontsize=2)

plt.xlim(-1.25, 1.25)
plt.ylim(-1.25, 1.25)
plt.title('Example')
plt.show()
</code>```

Which produces

What this doesn't show, however, is how may connections there are between each node. For example, A->B actually has three edges. nx.MultiGraph() will make some edges appear thicker than others, but what I actually want is the actual number of edges between two nodes displayed on the plot. Such that the label for 'B' is 'B (3)' (or something like that).

I know that nx.Graph.number_of_edges() can tell me the amount edges between nodes, but I want to display the number of edges between two nodes as a count on the plot programmatically.

答:
You can adjust your dataframe to include the edge numbers in your target node string:

```<code>data = {'source': ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'],
        'target': ['B', 'B', 'C', 'D', 'E', 'B', 'C', 'E', 'F', 'C']}
df = pd.DataFrame(data=data)

df = df.groupby(df.columns.tolist()).size().reset_index().rename(columns={0:'edges'})
df['target'] = df['target'] + ' (' + df['edges'].astype(str) + ')'
</code>```

Body:
I am making a network graph from a dataframe, as shown below

import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt

data = {'source': ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'],
        'target': ['B', 'B', 'C', 'D', 'E', 'B', 'C', 'E', 'F', 'C']}
df = pd.DataFrame(data=data)

G = nx.from_pandas_edgelist(df, source='source', create_using=nx.Graph(), target='target')
pos = nx.spring_layout(G)
nx.draw_networkx(G, pos, with_labels=False, node_color='#1f0ee3', node_size=150,
                 edge_color='r', width=1, alpha=0.6, style='dashed',
                 font_color='k', font_size=15, font_weight=20)
# Offset for node labels
offset = 0.15
pos_labels = {}
keys = pos.keys()
for key in keys:
    x, y = pos[key]
    pos_labels[key] = (x, y + offset)
nx.draw_networkx_labels(G, pos=pos_labels, fontsize=2)

plt.xlim(-1.25, 1.25)
plt.ylim(-1.25, 1.25)
plt.title('Example')
plt.show()

Which produces

What this doesn't show, however, is how may connections there are between each node. For example, A->B actually has three edges. nx.MultiGraph() will make some edges appear thicker than others, but what I actually want is the actual number of edges between two nodes displayed on the plot. Such that the label for 'B' is 'B (3)' (or something like that).

I know that nx.Graph.number_of_edges() can tell me the amount edges between nodes, but I want to display the number of edges between two nodes as a count on the plot programmatically.

Body:
You can adjust your dataframe to include the edge numbers in your target node string:

data = {'source': ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'],
        'target': ['B', 'B', 'C', 'D', 'E', 'B', 'C', 'E', 'F', 'C']}
df = pd.DataFrame(data=data)

df = df.groupby(df.columns.tolist()).size().reset_index().rename(columns={0:'edges'})
df['target'] = df['target'] + ' (' + df['edges'].astype(str) + ')'


问:
JDBC Exception running on AIX (IBM JDK) with JDBC driver version 3.11.1
We are facing issues when using Snowflake JDBC driver 3.11.1 on AIX platforms with IBM JDK. Even basic select queries are failing with below exception. It used to work with earlier version 3.10.3. Did something broke in recent version of JDBC driver?

This is also observed in other big endian platforms like Solaris SPARC and hp ia  (big-endian). Is this a known issue?

```<code>Caused by: java.lang.IllegalStateException: Arrow only runs on LittleEndian systems.
at net.snowflake.client.jdbc.internal.io.netty.buffer.UnsafeDirectLittleEndian.<init>(UnsafeDirectLittleEndian.java:65)
at net.snowflake.client.jdbc.internal.io.netty.buffer.UnsafeDirectLittleEndian.<init>(UnsafeDirectLittleEndian.java:50)
at net.snowflake.client.jdbc.internal.io.netty.buffer.PooledByteBufAllocatorL.<init>(PooledByteBufAllocatorL.java:50)
at net.snowflake.client.jdbc.internal.apache.arrow.memory.AllocationManager.<clinit>(AllocationManager.java:53)
</code>```

答: Snowflake only supports Oracle Java or OpenJDK.</p>

Body:
We are facing issues when using Snowflake JDBC driver 3.11.1 on AIX platforms with IBM JDK. Even basic select queries are failing with below exception. It used to work with earlier version 3.10.3. Did something broke in recent version of JDBC driver?

This is also observed in other big endian platforms like Solaris SPARC and hp ia  (big-endian). Is this a known issue?

Caused by: java.lang.IllegalStateException: Arrow only runs on LittleEndian systems.
at net.snowflake.client.jdbc.internal.io.netty.buffer.UnsafeDirectLittleEndian.<init>(UnsafeDirectLittleEndian.java:65)
at net.snowflake.client.jdbc.internal.io.netty.buffer.UnsafeDirectLittleEndian.<init>(UnsafeDirectLittleEndian.java:50)
at net.snowflake.client.jdbc.internal.io.netty.buffer.PooledByteBufAllocatorL.<init>(PooledByteBufAllocatorL.java:50)
at net.snowflake.client.jdbc.internal.apache.arrow.memory.AllocationManager.<clinit>(AllocationManager.java:53)


问:
Dynamically including/excluding fields from Meta class of a Django ModelForm
Let's say I have a form such as:

from django import forms

class Foo(forms.ModelForm):
    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')
```

How can I include or exclude fields based on some condition?

Edit:

My bad, I should have clarified that the condition needs to be made based on a value on each model that is being rendered. That means that I need to add (or remove) fields based on the values of the model that is currently being rendered.

答:
You can modify form fields via __init__:

```<code>from django import forms

class Foo(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if condition:
            self.fields.pop('field1')

    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')
</code>```

Note that this can cause the form's validation to fail if the field is required.

A better approach might be to hide the field, instead of removing it entirely:

```<code>class Foo(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if condition:
            form.fields['field1'].widget = forms.HiddenInput()

    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')
</code>```

Body:
Let's say I have a form such as:

from django import forms

class Foo(forms.ModelForm):
    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')

How can I include or exclude fields based on some condition?

Edit:

My bad, I should have clarified that the condition needs to be made based on a value on each model that is being rendered. That means that I need to add (or remove) fields based on the values of the model that is currently being rendered.

Body:
You can modify form fields via __init__:

from django import forms

class Foo(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if condition:
            self.fields.pop('field1')

    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')

Note that this can cause the form's validation to fail if the field is required.

A better approach might be to hide the field, instead of removing it entirely:

class Foo(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if condition:
            form.fields['field1'].widget = forms.HiddenInput()

    class Meta:
        model = SomeModel
        fields = ('field1', 'field2', 'field3')


问:
How to configure backend URL in Protractor (frontend project)
I have two separate projects. One frontend (Angular V6) and another backend (Springboot v2).

I'm trying to implement e2e tests with Protractor, however I can't configure the backend URL correctly in the frontend project.

My protractor.conf.js:

```<code>const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 900000000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.e2e.json')
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};
</code>```

The backend project is running at this address: http://localhost:8080/

The frotend project is running at this address: http://localhost:4200/

When opening the test page, the frontend project tries to access a service at the following url: http://localhost:4200/car/

and it should be at this URL: http://localhost:8080/car

And so the test breaks because there is no such URL: http://localhost:4200/car.

So the question is:
Is there any way I can configure the backend URL in the frontend project?

答:
yes, you can setup angular proxy to forward some endpoints to your backend.
create proxy.conf.js

```<code>const PROXY_CONFIG = [
    {
        context: [
            "/car",
            "/anything"
        ],
        target: "http://localhost:8080",
        secure: false
    }
]

module.exports = PROXY_CONFIG;
</code>```

and add it to your angular.cli serve configuration

```<code>....
"architect": {
  "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "proxyConfig": "src/proxy.conf.js"
    },
</code>```

Body:
I have two separate projects. One frontend (Angular V6) and another backend (Springboot v2).

I'm trying to implement e2e tests with Protractor, however I can't configure the backend URL correctly in the frontend project.

My protractor.conf.js:

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 900000000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.e2e.json')
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

The backend project is running at this address: http://localhost:8080/

The frotend project is running at this address: http://localhost:4200/

When opening the test page, the frontend project tries to access a service at the following url: http://localhost:4200/car/

and it should be at this URL: http://localhost:8080/car

And so the test breaks because there is no such URL: http://localhost:4200/car.

So the question is:
Is there any way I can configure the backend URL in the frontend project?

Body:
yes, you can setup angular proxy to forward some endpoints to your backend.
create proxy.conf.js

const PROXY_CONFIG = [
    {
        context: [
            "/car",
            "/anything"
        ],
        target: "http://localhost:8080",
        secure: false
    }
]

module.exports = PROXY_CONFIG;

and add it to your angular.cli serve configuration

....
"architect": {
  "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "proxyConfig": "src/proxy.conf.js"
    },


答:
USE for examlple IF condition  OR A CASE wHEN like in the example

```<code>CREATE TABLE grades (
  `Name` VARCHAR(4),
  `Score` INTEGER,
  `Age` INTEGER
);

INSERT INTO grades
  (`Name`, `Score`, `Age`)
VALUES
  ('Sam', '90', '10'),
  ('Lucy', '95', '11'),
  ('Kim', '85', '12'),
  ('Tim', '86', '10'),
  ('Jack', '80', '9'),
  ('Tom', '60', '10'),
  ('John', '62', '11');
</code>```
```
✓

✓
```

```<code>SELECT
  g.*
  , IF(Score <= 100  AND Score >= 90,'A',IF(Score >= 80  AND Score <= 89,'B','C')) Grade
FROM grades g
ORDER BY Grade ASC
</code>```
```
Name | Score | Age | Grade
:--- | ----: | --: | :----
Sam  |    90 |  10 | A
Lucy |    95 |  11 | A
Kim  |    85 |  12 | B
Tim  |    86 |  10 | B
Jack |    80 |   9 | B
Tom  |    60 |  10 | C
John |    62 |  11 | C
```

```<code>SELECT
  g.*
  ,
  CASE WHEN Score <= 100  AND Score >= 90 THEN'A'
  WHEN Score >= 80  AND Score <= 89 THEN 'B'
  ELSE 'C'
  END Grade
FROM grades g
ORDER BY Grade ASC
</code>```
```
Name | Score | Age | Grade
:--- | ----: | --: | :----
Sam  |    90 |  10 | A
Lucy |    95 |  11 | A
Kim  |    85 |  12 | B
Tim  |    86 |  10 | B
Jack |    80 |   9 | B
Tom  |    60 |  10 | C
John |    62 |  11 | C
```

db<>fiddle here

Title: How to sort by range category?

Body:
I have the following table:

+------+-------+------+
| Name | Score | Age  |
+------+-------+------+
| Sam  |    90 |   10 |
| Kim  |    85 |   12 |
| Tom  |    60 |   10 |
| Tim  |    86 |   10 |
| Lucy |    95 |   11 |
| Jack |    80 |    9 |
| John |    62 |   11 |
+------+-------+------+

I want to map the score to grade 'A'(90-100),'B'(80-89),'C'(<80) and then sort by grade (ASC) and age (ASC) using MySql. So the result should look like this:

+------+-------+------+-------+
| Name | Score | Age  | Grade |
+------+-------+------+-------+
| Sam  |    90 |   10 |   A   |
| Lucy |    95 |   11 |   A   |
| Jack |    80 |    9 |   B   |
| Tim  |    86 |   10 |   B   |
| Kim  |    85 |   12 |   B   |
| Tom  |    60 |   10 |   C   |
| John |    62 |   11 |   C   |
+------+-------+------+-------+

Thanks!

Body:
USE for examlple IF condition  OR A CASE wHEN like in the example

CREATE TABLE grades (
  `Name` VARCHAR(4),
  `Score` INTEGER,
  `Age` INTEGER
);

INSERT INTO grades
  (`Name`, `Score`, `Age`)
VALUES
  ('Sam', '90', '10'),
  ('Lucy', '95', '11'),
  ('Kim', '85', '12'),
  ('Tim', '86', '10'),
  ('Jack', '80', '9'),
  ('Tom', '60', '10'),
  ('John', '62', '11');

✓

✓

SELECT
  g.*
  , IF(Score <= 100  AND Score >= 90,'A',IF(Score >= 80  AND Score <= 89,'B','C')) Grade
FROM grades g
ORDER BY Grade ASC

Name | Score | Age | Grade
:--- | ----: | --: | :----
Sam  |    90 |  10 | A
Lucy |    95 |  11 | A
Kim  |    85 |  12 | B
Tim  |    86 |  10 | B
Jack |    80 |   9 | B
Tom  |    60 |  10 | C
John |    62 |  11 | C

SELECT
  g.*
  ,
  CASE WHEN Score <= 100  AND Score >= 90 THEN'A'
  WHEN Score >= 80  AND Score <= 89 THEN 'B'
  ELSE 'C'
  END Grade
FROM grades g
ORDER BY Grade ASC

Name | Score | Age | Grade
:--- | ----: | --: | :----
Sam  |    90 |  10 | A
Lucy |    95 |  11 | A
Kim  |    85 |  12 | B
Tim  |    86 |  10 | B
Jack |    80 |   9 | B
Tom  |    60 |  10 | C
John |    62 |  11 | C

db<>fiddle here


问:
Global error handling of file_get_contents() PHP
I am occasionally getting errors while using file_get_contents and its used a fair bit in my script. I know I can suppress errors individually with @file_get_contents and that I can set global error messages with

```<code>//error handler function
function customError($errno)
  {
  echo 'Oh No!';
  }

//set error handler
set_error_handler("customError");
</code>```

But how do I specifically set an error handler for all file_get_content's uses?

Thanks

答:
@ does not really suppress the errors as you've discovered. They still show up in your custom error handler. And to have "suppressed" errors ignored there, you have to first probe for the current error_level:

```<code>function customError($errno)
{
   if ( !error_reporting() ) return;

   echo 'Oh No!';
}

// That's what PHPs default error handler does too.
</code>```

Just guessing. If you meant something different, please extend your question. (You cannot have an error handler invoked for each file_get_contents call - if there didn't occur any error.)

Body:
I am occasionally getting errors while using file_get_contents and its used a fair bit in my script. I know I can suppress errors individually with @file_get_contents and that I can set global error messages with

//error handler function
function customError($errno)
  {
  echo 'Oh No!';
  }

//set error handler
set_error_handler("customError");

But how do I specifically set an error handler for all file_get_content's uses?

Thanks

Body:
@ does not really suppress the errors as you've discovered. They still show up in your custom error handler. And to have "suppressed" errors ignored there, you have to first probe for the current error_level:

function customError($errno)
{
   if ( !error_reporting() ) return;

   echo 'Oh No!';
}

// That's what PHPs default error handler does too.

Just guessing. If you meant something different, please extend your question. (You cannot have an error handler invoked for each file_get_contents call - if there didn't occur any error.)

ContentLicense: CC BY-SA 3.0


问:
Mixed content with hls.js
I am trying to play HLS streams using the hls.js library, the problem is that the site I'm trying to play streams on is https, the url to get the manifest is https so I get that fine but the links to the individual chunks are http.

Hls.js uses XHR to get these chunks, which causes a mixed content error on my site. The stream provider does not serve these chunks over ssl and they don't have such plans in the near future. Is there a clever trickery I can use to get around this without comprmising the security on my site?

I have googled for similar issue with this library and I came across this issue but it's not resolved. A possible solution would be to open a separate page and load the streams on there but that is last ditch.

答:
In my case I was passing an https url and requests still went out as http for some reason. I'm guessing there is some regex or parse error in their code but I was able to fix my mixed content issue with this snippet:

let hls = new Hls({
    xhrSetup: (xhr, url) => {
        xhr.open('GET', url.replace('http://', 'https://'))
    }
})
```

Title: Mixed content with hls.js