NPE in JmsConnector when stream is closed before

When terminating JmsConsumer stream via JmsConsumerControl.shutdown() just after it’s materialized getting NPE in akka.stream.alpakka.jms.impl.JmsConnector#updateStateWith in the statement “connectionStateQueue.offer(connectionState)”, connectionStateQueue is null.

Is it a bug or I am misusing it?

Hi mrbald,

It’s a bit of both. You’re asking for it to shutdown too fast…
The current implementation initiates the connectionStateQueue in preStart which will get called quite early, but not fast enough so that you can call shutdown immediately after creating the JMS consumer.

To protect against this, the connectionStateQueue should get assigned some dummy implementation which is almost immediately overwritten in preStart.

Feel free to suggest that in a Pull Request.

Cheers,
Enno.