@Inject
private CustomerWebController customerController;
-
/**
* Object message
*/
*/
private Queue queue;
-
/**
* Receipt bean
*/
try {
// Get initial context
Context context = new InitialContext();
+
// Get factory from JMS resource
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("jms/shopConnectionFactory"); //NOI18N
+
// Lookup queue
this.queue = (Queue) context.lookup("jms/shopCheckoutQueue"); //NOI18N
// Create connection
this.connection = connectionFactory.createConnection();
+
// Init session instance
this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
// And message producer
this.messageProducer = this.session.createProducer(this.queue);
+
// Finally the message instance itself
this.message = this.session.createObjectMessage();
- }catch (final NamingException | JMSException e) {
+ } catch (final NamingException | JMSException e) {
// Continued to throw
throw new FacesException(e);
}