[JBoss-user] [Messaging, JMS JBossMQ] - Re: JMS Client not able to pull any messages from the Queue

2004-06-17 Thread brightsunny2020
Thanks dannyyates

I tried by seting the persistence mode to message, didn't work. Then I tried setting 
the persistence mode for both QueuSender and Message, still no luck

Can u pls. take a look at the code or Please copypaste ur code here that works for 
you. I am using to the file system persistence


public class SimpleQueueSender {



/**
 * Main method.
 *
 * @param args the queue used by the example and,
 * optionally, the number of messages to send
 */
public static void main(String[] args) {
String  queueName = null;
Context jndiContext = null;
QueueConnectionFactory  queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSessionqueueSession = null;
Queue   queue = null;
QueueSender queueSender = null;
TextMessage message = null;
final int   NUM_MSGS;

// Initial context strings
String PROVIDER_URL = java.naming.provider.url;
String NAMING_FACTORY = java.naming.factory.initial;
String CONTEXT_FACTORY =
org.jnp.interfaces.NamingContextFactory;

String jndiHost = localhost:1099; 
NUM_MSGS = 5;
queueName = queue/orafin/OrafinServices;

Properties props = new Properties();
props.put(NAMING_FACTORY, CONTEXT_FACTORY);
props.put(PROVIDER_URL, jndiHost);

/* 
 * Create a JNDI API InitialContext object if none exists
 * yet.
 */
try {
jndiContext = new InitialContext(props);
} catch (NamingException e) {
System.out.println(Could not create JNDI API  +
context:  + e.toString());
System.exit(1);
}

/* 
 * Look up connection factory and queue.  If either does
 * not exist, exit.
 */
try {
queueConnectionFactory = (QueueConnectionFactory)
jndiContext.lookup(ConnectionFactory);   
 
queue = (Queue) jndiContext.lookup(queueName);
} catch (NamingException e) {
System.out.println(JNDI API lookup failed:  + 
e.toString());
System.exit(1);
}

/*
 * Create connection.
 * Create session from connection; false means session is
 * not transacted.
 * Create sender and text message.
 * Send messages, varying text slightly.
 * Send end-of-messages message.
 * Finally, close connection.
 */
try {
queueConnection = 
queueConnectionFactory.createQueueConnection();
queueSession = 
queueConnection.createQueueSession(false, 
Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
queueSender.setDeliveryMode(DeliveryMode.PERSISTENT);
message = queueSession.createTextMessage();
for (int i = 0; i  NUM_MSGS; i++) {
message.setText(This is message  + (i + 1));
System.out.println(Sending message:  + 
message.getText());
message.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
queueSender.send(message);
}

/* 
 * Send a non-text control message indicating end of
 * messages.
 */
queueSender.send(queueSession.createMessage());
} catch (JMSException e) {
System.out.println(Exception occurred:  + 
e.toString());
} finally {
if (queueConnection != null) {
try {
queueConnection.close();
} catch (JMSException e) {}
}
}
}
}



import javax.jms.*;
import 

[JBoss-user] [Messaging, JMS JBossMQ] - Re: JMS Client not able to pull any messages from the Queue

2004-06-16 Thread brightsunny2020


Thanks dannyyates


Yes, I read JMS Spec


and I set the delivery mode to PERSISTENT also


Thanks
Sunny


View the original post : 
http://www.jboss.org/index.html?module=bbop=viewtopicp=3838972#3838972

Reply to the post : 
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3838972


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS JBossMQ] - Re: JMS Client not able to pull any messages from the Queue

2004-06-16 Thread dannyyates
OK. I assume it still doesn't work? Are you setting the PERSISTENT property CORRECTLY? 
I vaguely recall there are two ways to do it. What works for me (although it appears 
to contradict the Javadoc for QueueSender) is to set the property on the Message 
immediatly before calling QueueSender.send()

Otherwise, are you persisting your messages to MySQL? I think there was a bug in a 
recent version of JBoss whereby the SQL for manipulating the MySQL JMS tables was 
wrong, and wouldn't reload messages on startup (or something like that).

Try upgrading to the latest version, and/or try persisting to a different database.

Failing that, start showing some code...

View the original post : 
http://www.jboss.org/index.html?module=bbop=viewtopicp=3838975#3838975

Reply to the post : 
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3838975


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS JBossMQ] - Re: JMS Client not able to pull any messages from the Queue

2004-06-15 Thread dannyyates
Have you read the JMS spec? Have you read about delivery modes?

View the original post : 
http://www.jboss.org/index.html?module=bbop=viewtopicp=3838750#3838750

Reply to the post : 
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3838750


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user