Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

Glassfish4, web and Java EE JMS

$
0
0

Hi,

I am trying a JMS webapp using Glassfish4 as the app server and I am facing troubles on the execution of the following method,

public void getMessage() {
try {
JMSConsumer receiver = context.createConsumer(topic);
String text = receiver.receiveBody(String.class);

if (text != null) {
myList.add(text);
} else {
FacesMessage facesMessage =
new FacesMessage("No message received after 1 second");
FacesContext.getCurrentInstance().addMessage(null, facesMessage);
}

} catch (Throwable t) {
logger.log(Level.SEVERE,
"ReceiverBean.receiveMessages: Exception: {0}",
t.toString());
}
}

This method is in a managed bean nemad ReceiverBean. The process is I send a message to the topic from the managed bean SenderBean and the receiver.xhtml file is loaded for calling the method from a commandLink. But it does not happen anything except the page stay waiting for this method to be resolved that ever occur.

Well the reasson of my post is to know how can I apply this method in a JSF webapp.

Kind regards,
Jose


Viewing all articles
Browse latest Browse all 1091

Trending Articles