zjnbshifox
Nov 2nd, 2005, 08:31 PM
I use ActiveMQ v3.2 as my JMS server and JmsTemplate send MESSAGE to a queue. ActiveMQ use the default configuration.When I send nearly 20 MESSAGEs to the queue(1MB per Message),It will get "Queue is Full ,must be dequeue " error.What's the problem? Then I use MySQL/PostgreSQL for persistence and got the same error with the same conditions.Is there any way to solve this problem?
I want to use ActiveMQ to send big file,how can I configure ActiveMQ or what I need to change in my program??
Thank you.
error message like this :
15:23:39 WARN Queue is full, waiting for it to be dequeued.
......
spring's config file:
<bean id="dest" class="org.activemq.message.ActiveMQQueue">
<constructor-arg index="0" value="TestHUGE8.Queue" />
</bean>
<bean id="jmsFactory" class="org.activemq.pool.PooledConnectionFactory">
<property name="connectionFactory">
<bean class="org.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.SingleConnectio nFactory">
<property name="targetConnectionFactory">
<ref local="jmsFactory"/>
</property>
</bean>
</property>
<property name="defaultDestination">
<ref bean="dest"/>
</property>
</bean>
java code like this:
for(int i=1;i<=100000;i++){
jms.send(new MessageCreator(){
public Message createMessage(Session s) throws JMSException {
StreamMessage bm = s.createStreamMessage();
File f = new File("f:\\haha.rar");
long l = f.length();
bm.setStringProperty("SN",String.valueOf(l));
byte[] bf = new byte[4096];
BufferedInputStream fis;
try {
fis = new BufferedInputStream(new FileInputStream(f));
int len =0;
bm.clearBody();
while((len = fis.read(bf))>0){
bm.writeBytes(bf,0,len);
}
fis.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
bm =null;
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
bm =null;
}
return bm;
}
});
log.info("sended " + i);
}
I want to use ActiveMQ to send big file,how can I configure ActiveMQ or what I need to change in my program??
Thank you.
error message like this :
15:23:39 WARN Queue is full, waiting for it to be dequeued.
......
spring's config file:
<bean id="dest" class="org.activemq.message.ActiveMQQueue">
<constructor-arg index="0" value="TestHUGE8.Queue" />
</bean>
<bean id="jmsFactory" class="org.activemq.pool.PooledConnectionFactory">
<property name="connectionFactory">
<bean class="org.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.SingleConnectio nFactory">
<property name="targetConnectionFactory">
<ref local="jmsFactory"/>
</property>
</bean>
</property>
<property name="defaultDestination">
<ref bean="dest"/>
</property>
</bean>
java code like this:
for(int i=1;i<=100000;i++){
jms.send(new MessageCreator(){
public Message createMessage(Session s) throws JMSException {
StreamMessage bm = s.createStreamMessage();
File f = new File("f:\\haha.rar");
long l = f.length();
bm.setStringProperty("SN",String.valueOf(l));
byte[] bf = new byte[4096];
BufferedInputStream fis;
try {
fis = new BufferedInputStream(new FileInputStream(f));
int len =0;
bm.clearBody();
while((len = fis.read(bf))>0){
bm.writeBytes(bf,0,len);
}
fis.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
bm =null;
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
bm =null;
}
return bm;
}
});
log.info("sended " + i);
}