-
1. Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 12, 2011 9:50 AM (in response to dmitry.sukhovilin)Version of HOrnetQ?
-
2. Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 12, 2011 9:52 AM (in response to dmitry.sukhovilin)What steps? It seems you missed typing something you meant to do?
-
3. Re: Hornetq stops working just after use QueueControl.moveMessages()
dmitry.sukhovilin May 12, 2011 10:05 AM (in response to clebert.suconic)Thank you for your answer.
I use HornetQ version 2.2.2.
All steps are described in .java sample file. You could find the file in my attachments.
-
4. Re: Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 12, 2011 3:04 PM (in response to dmitry.sukhovilin)Which java file? which sample? (We have so many)
-
5. Re: Hornetq stops working just after use QueueControl.moveMessages()
dmitry.sukhovilin May 12, 2011 4:56 PM (in response to clebert.suconic)Thanks for the answer.
Clebert Suconic wrote:
Which java file? which sample? (We have so many)
You can see the file in my attachments. (http://community.jboss.org/servlet/JiveServlet/download/604954-32850/POC1.java.zip)
package hornet.tests.bug1;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientRequestor;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.management.ManagementHelper;
import org.hornetq.api.core.management.ResourceNames;
class DummyObject implements Serializable {
private static final long serialVersionUID = 8924860462157420217L;
private byte[] body = new byte[2000];
public byte[] getBody() {
return body;
}
public void setBody(byte[] body) {
this.body = body;
}
}
public class POC1 {
private static final String Q1 = "queue.Test1";
private static final String Q2 = "queue.Test2";
private static final String MANAGEMENT_QUEUE = "jms.queue.hornetq.management";
private static final int NUM_SEND = 1 * 60 * 1000;
private static final int PRINT_AFTER_X_MESSAGES_SEND = 10 * 1000;
private static final String username = "foo";
private static final String password = "bar";
private static final String SERVER_IP = "127.0.0.1";
private static final int SERVER_PORT = 5445;
public static void sendOneMessage(DummyObject sms, ClientSession session, ClientProducer cp) {
ClientMessage cm;
try {
cm = session.createMessage(true);
ByteArrayOutputStream bos = new ByteArrayOutputStream() ;
ObjectOutput out;
out = new ObjectOutputStream(bos);
out.writeObject(sms);
out.close();
cm.getBodyBuffer().writeBytes( bos.toByteArray() );
cp.send(cm);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void sendMessages(ClientSession session, ClientProducer cp, long num) {
for(int i=1; i <= num; i++) {
DummyObject msg = new DummyObject();
sendOneMessage(msg, session, cp);
if ( (i % PRINT_AFTER_X_MESSAGES_SEND) == 0 ) {
System.out.print(i / PRINT_AFTER_X_MESSAGES_SEND + " ");
}
}
}
public static void receiveMessages(ClientSession session, ClientConsumer cc, long k) throws HornetQException, IOException, ClassNotFoundException {
ClientMessage received;
long countMsg = 0;
while ( (received = cc.receive(1500)) != null ) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
received.saveToOutputStream(baos);
ObjectInputStream in = new ObjectInputStream(
new ByteArrayInputStream(baos.toByteArray()));
DummyObject sms = (DummyObject) in.readObject();
in.close();
countMsg++;
if (countMsg >= k) {
break;
}
}
}
public static void main(String[] args) throws Exception {
ServerLocator locator = null;
ClientSession session = null;
ClientSessionFactory csf = null;
try {
Map<String, Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, SERVER_PORT);
connectionParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, SERVER_IP);
TransportConfiguration transportConfiguration = new TransportConfiguration(
"org.hornetq.core.remoting.impl.netty.NettyConnectorFactory", connectionParams);
locator = HornetQClient.createServerLocatorWithoutHA(transportConfiguration);
csf = locator.createSessionFactory();
session = csf.createSession(username, password, false, true, true, false, 1);
session.start();
// step 1. send many msg (paging begin)
System.out.println("step 1");
ClientProducer cp = session.createProducer(Q1);
sendMessages(session, cp, NUM_SEND);
// step 2. messageMove
System.out.println("step 2");
ClientRequestor requestor = new ClientRequestor(session, MANAGEMENT_QUEUE);
String resource = ResourceNames.CORE_QUEUE + Q1;
ClientMessage message = session.createMessage(false);
ManagementHelper.putOperationInvocation(message, resource, "moveMessages", "", Q2);
ClientMessage reply = requestor.request(message);
boolean success = ManagementHelper.hasOperationSucceeded(reply);
if (success) {
System.out.println("moveMessages SUCCESS");
} else {
System.out.println("moveMessages FAIL");
}
// step3. wait some time
System.out.println("step 3");
System.out.println("Press 'enter'");
System.in.read();
// step4. check query size
System.out.println("step 4");
ClientSession.QueueQuery qq1 = session.queueQuery(new SimpleString(Q1));
ClientSession.QueueQuery qq2 = session.queueQuery(new SimpleString(Q2));
System.out.println(Q1 + " size: " + qq1.getMessageCount());
System.out.println(Q2 + " size: " + qq2.getMessageCount());
// step5. try read from Q1
System.out.println("step 5");
ClientConsumer cc = session.createConsumer(Q1);
receiveMessages(session, cc, 3);
// step6. try write from Q1
System.out.println("step 6");
sendMessages(session, cp, 7);
// step7. check query size
System.out.println("step 7");
System.out.println(Q1 + " size: " + qq1.getMessageCount());
System.out.println(Q2 + " size: " + qq2.getMessageCount());
cp.close();
requestor.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(session != null) {
try {
session.close();
} catch (HornetQException e) {
e.printStackTrace();
}
}
if(csf != null) {
csf.close();
}
if (locator != null) {
locator.close();
}
}
}
}
-
6. Hornetq stops working just after use QueueControl.moveMessages()
dmitry.sukhovilin May 13, 2011 7:49 AM (in response to dmitry.sukhovilin)Hello there,
I am about to use HornetQ on my production server. Could any one help me?
Thank you.
-
7. Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 13, 2011 12:47 PM (in response to dmitry.sukhovilin)You never described the error other than I have an issue...
Can you provide some logs? Exceptions?
What exactly are you saying it's not working?
-
8. Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 13, 2011 12:48 PM (in response to dmitry.sukhovilin)Besides... This is not a paid support service ;-) First come, first serve!
-
9. Hornetq stops working just after use QueueControl.moveMessages()
dmitry.sukhovilin May 16, 2011 3:54 AM (in response to clebert.suconic)I moved all the messages from queue (queue.Test1) into queue (queue.Test2), API (method ManagementHelper.hasOperationSucceeded()) sad that my movement was SUCCESSFUL. but, all messages which was in paging files - left on their places in paging. Even more, I can't read from and write to queue.Test1 AT ALL. No exeption was thrown.
But the way, I can't to buy a paid service so far, becouse I should be sure in quality of Hornetq.
-
10. Re: Hornetq stops working just after use QueueControl.moveMessages()
leosbitto May 16, 2011 8:09 AM (in response to dmitry.sukhovilin)Dmitry Sukhovilin wrote:
But the way, I can't to buy a paid service so far, becouse I should be sure in quality of Hornetq.
Unfortunatelly you most probably couldn't buy a paid support for HornetQ even if you wanted to. It was promised to be available as a part of JBoss EAP 5.1.0, but that was withdrawn, and when I asked RedHat representative about the possibility of paid HornetQ support, I was promised that something should be available mid-February 2011, however there is still nothing. I hope that at least some kind of paid support will be available in JBoss EAP 5.1.1, but that is still a moving target - both the release date and the scope of HornetQ support.
-
11. Re: Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 16, 2011 11:58 AM (in response to leosbitto)There was a code change I've made around paging on deleteMessages as it wouldn't work with paged messages before.
The messages should still be at the previous destination.
If you open a JIRA, I will make sure this will work with moveMessages also as I'm currently working on a few paging changes.
Can you try a new build from this branch: http://anonsvn.jboss.org/repos/hornetq/branches/Branch_2_2_EAP/
-
12. Re: Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 16, 2011 12:00 PM (in response to leosbitto)Leos Bitto wrote:
Dmitry Sukhovilin wrote:
But the way, I can't to buy a paid service so far, becouse I should be sure in quality of Hornetq.
Unfortunatelly you most probably couldn't buy a paid support for HornetQ even if you wanted to. It was promised to be available as a part of JBoss EAP 5.1.0, but that was withdrawn, and when I asked RedHat representative about the possibility of paid HornetQ support, I was promised that something should be available mid-February 2011, however there is still nothing. I hope that at least some kind of paid support will be available in JBoss EAP 5.1.1, but that is still a moving target - both the release date and the scope of HornetQ support.
All I can say is that we are working towards it. We have done a lot of QA on HornetQ to make it become a product. There are a few last requirements QA is asking us to fullfill what should happen by 5.1.2.
-
13. Re: Hornetq stops working just after use QueueControl.moveMessages()
clebert.suconic May 16, 2011 12:01 PM (in response to clebert.suconic)EAP 5.1.1 will already have HornetQ as tech preview.
-
14. Re: Hornetq stops working just after use QueueControl.moveMessages()
dmitry.sukhovilin Jun 9, 2011 9:59 AM (in response to clebert.suconic)Thank you for your information.
I refused to use persistent of hornetq.
Have a nice day.