Q: Consume jms message when I want I want to send a message to queue without consumer or with an inactive consumer. And messages are consumed (read) later. Below I show what looks like my idea.
The code which send the message to the queue
@Resource(mappedName = "java:/JmsXA")
private QueueConnectionFactory queueConnectionFactory;

@Resource(mappedName = "queue/DocumentServiceMessageBeanPlanified")
private Queue documentQueueDestinationPlanified;

...

public anExampleMethod() {
    QueueConnection queueConnection;
    queueConnection = this.queueConnectionFactory.createQueueConnection();
    QueueSession queueSession = queueConnection.createQueueSession(false, javax.jms.Session.CLIENT_ACKNOWLEDGE);
    MessageProducer queueSender = queueSession.createSender(this.documentQueueDestinationPlanified);
    Message messagePlanified = queueSession.createMessage();

    // populate message

    queueSender.send(messagePlanified);
    queueSender.close();
    queueSession.close();
    queueConnection.close();
}

The code which read/consume message : 
public void otherMethod() throws JMSException {
    QueueConnection queueConnection;
    queueConnection = this.queueConnectionFactory.createQueueConnection();
    QueueSession queueSession =
        queueConnection.createQueueSession(false, javax.jms.Session.CLIENT_ACKNOWLEDGE);

    MessageConsumer queueConsumer =
        queueSession.createConsumer(this.documentQueueDestinationPlanified);

    Message aMessage = queueConsumer.receiveNoWait();
    while (aMessage != null) {
        aMessage.acknowledge();

        // some work here with message informations

        aMessage = queueConsumer.receiveNoWait();
    }

    queueConsumer.close();
    queueSession.close();
    queueConnection.close();
}

The otherMethod has to be launch only at special moment. Is there a special configuration to do? Because I get this error : 
javax.ejb.EJBException: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.sylob.cochise.dm1.ejb.entite.document.DocumentServiceBean/documentQueueDestinationPlanified into property com.sylob.cochise.dm1.ejb.entite.document.DocumentServiceBean.documentQueueDestinationPlanified: DocumentServiceMessageBeanPlanified not bound
// do you want all the stack trace?

I already use some message queue but with messagedrivenbean or here I need to read at special moment messages :/

A: Provided that the queue is persistent the general idea seems reasonable. I can see no obvious error in your code and the error message points to a configuration issue. It seems to ignore your mappedName definition. Application servers are not required to handle mappedName consistently. Perhaps your server ignores it. Try the same annotations with only the sending method or with an MDB and see if that works, also try a JNDI browser or a manual lookup with the mapped name and see if you can resolve the entries that way. I bet that a manual lookup will work (though injection is nicer, of course)!
In addition it would help to know what application server you are using?
