I'm not sure i understand your question but...
"is it possible to delete message from inbox queue only after success processing the message? "
yes. if you're using CMT, this is the behaviour the container provides you automatically if you're using the REQUIRED transaction attribute (the default). if some problem results in a system (runtime) exception, the container automatically rollbacks your changes, including putting the message back in the queue.
if you're using BMT, the spec states that:
5.4.14 Message Acknowledgment for JMS Message-Driven Beans
JMS message-driven beans should not attempt to use the JMS API for message acknowledgment. Message
acknowledgment is automatically handled by the container. If the message-driven bean uses container-
managed transaction demarcation, message acknowledgment is handled automatically as a part of
the transaction commit. If bean-managed transaction demarcation is used, the message receipt cannot be
part of the bean-managed transaction, and, in this case, the receipt is acknowledged by the container. If
bean-managed transaction demarcation is used, the Bean Provider can indicate whether JMS
AUTO_ACKNOWLEDGE semantics or DUPS_OK_ACKNOWLEDGE semantics should apply by using the
activationConfig element of the MessageDriven annotation or by using the activation-
config-property deployment descriptor element. The property name used to specify the
acknowledgment mode is acknowledgeMode. If the acknowledgeMode property is not specified,
JMS AUTO_ACKNOWLEDGE semantics are assumed. The value of the acknowledgeMode property
must be either Auto-acknowledge or Dups-ok-acknowledge for a JMS message-driven bean.
I've never used BMT with MDBs so someone more experienced should help you but my interpretation of the quote above - taking into consideration the normal non-mdb semantics of jms acknowledgment - is that rolling back just by itself (calling the
UserTransaction.rollback method ) will not put the message back in the queue, but if you would throw a runtime exception from the
onMessage method the container should not acknowledge the receipt and therefore the message would not be dequeued.
"the problem is that messages will be deleted when MDB will be called to proceed message".
Actually, as i've tried to show you, this is not necessarily true.
Please do let me know if I'm wrong about the bmt stuff. I don't have the time to
test it.