activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramdas Sawant" <replyram...@gmail.com>
Subject Re: AMQ Message Store setting
Date Tue, 29 Jul 2008 07:07:56 GMT
Hi Rob,
            Thanks Rob for your reply. Below is the method i am using for
generating messages
///////////////////////////////////////////////////////////

*public* *void* startPublishing(String protocol, String host, String port)*
throws* JMSException {

hostString = protocol + "://" + host + ":" + port;

System.*out*.println("Connecting to " + hostString);

connectionFactory = *new* ActiveMQConnectionFactory(user, pwd, hostString);

conn = (TopicConnection) connectionFactory.createTopicConnection();

tSession = conn.createTopicSession(*false*,javax.jms.Session.*
AUTO_ACKNOWLEDGE*);

String topicName = System.*getProperty*("topic", "IQBridge");

eventTopic = tSession.createTopic(topicName);

//tSubscriber = tSession.createSubscriber(eventTopic);

tPublisher = tSession.createPublisher(eventTopic);

conn.start();

*int* i = 0;

*boolean* b = *true*;

*while*(b){

i++;

//if(i==10) b= false;

TextMessage m = tSession.createTextMessage();

m.setText("Pl. find attached the CX Events to IQ messages detail mapping i
Pl. find attached the CX Events to IQ messages detail mapping i Pl. find
attached the CX Events to IQ messages detail mapping i Pl. find attached the
CX Events to IQ messages detail mapping i Pl. find attached the CX Events to
IQ messages detail mapping i Pl. find attached the CX Events to IQ messages
detail mapping i Pl. find attached the CX Events to IQ messages detail
mapping i Pl. find attached the CX Events to IQ messages detail mapping i
Pl. find attached the CX Events to IQ messages detail mapping i Pl. find
attached the CX Events to IQ messages detail mapping i Pl. find attached the
CX Events to IQ messages detail mapping i Pl. find attached the CX Events to
IQ messages detail mapping i Pl. find attached the CX Events to IQ messages
detail mapping i Pl. find attached the CX Events to IQ messages detail
mapping i Pl. find attached the CX Events to IQ messages detail mapping i
Pl. find attached the CX Events to IQ messages detail mapping i Pl. find
attached the CX Events to IQ messages detail mapping i Pl. find attached the
CX Events to IQ messages detail mapping i Pl. find attached the CX Events to
IQ messages detail mapping i Pl. find attached the CX Events to IQ messages
detail mapping i Pl. find attached the CX Events to IQ messages detail
mapping i Pl. find attached the CX Events to IQ messages detail mapping i
Pl. find attached the CX Events to IQ messages detail mapping i Pl. find
attached the CX Events to IQ messages detail mapping i Pl. find attached the
CX Events to IQ messages detail mapping i = "+i);

*try* {

System.*out*.println("trying to publish " + i);

//m.setJMSExpiration(600000);

tPublisher.publish(m,DeliveryMode.*PERSISTENT*,Message.*DEFAULT_PRIORITY*
,600000);

System.*out*.println("Published " + i);

} *catch* (Exception e) {

b = *false*;

System.*out*.println("\n i = " + i + "\n");

e.printStackTrace();

}*catch*(Throwable t ){

b = *false*;

System.*out*.println("\nThrowabel i = " + i + "\n");

t.printStackTrace();

}

}

// tSubscriber.setMessageListener(listener);

tSession.close();

tPublisher.close();

conn.stop();

conn.close();

}
/////////////////////////////////////////////////////////////
I have already attached the activemq.xml of my broker in the current mail
thread. What is happening is the data files of size 2mb are getting created
as i have set the "maxFileLength" to 2mb. what i assumed/thought is due to
setting of <storeUsage limit="4 mb" name="foo"/>, only 2 data files should
get generated as i have set the maxFileLength to 2 mb and my storage usage
limit is 4 mb. Am i missing some thing here... i am not sure. Let me know if
you need any more clarification. Thanks in advance.


On 7/29/08, Rob Davies <rajdavies@gmail.com> wrote:
>
> That name attribute IS confusing - it doesn't do anything - as the store
> usage limit is broker wide - you don't need to use a name btw.
> So with the limit set to 4mb - this hint is sent to the Message Store - but
> only the default store - the AMQPersistence Adaptor will use it currently -
> so its maximum size will be 4mb.
> Maybe you can submit a test case - so we can better understand why the
> store limit is working for your case ?
>
> cheers,
>
> Rob
>
> On 29 Jul 2008, at 05:30, Ramdas Sawant wrote:
>
> Guys, ant thoughts on this mail thread ??? I am really stuck and need some
>> help here .... Waiting for inputs... Thanks in advance
>>
>> On 7/28/08, Ramdas Sawant <replyramdas@gmail.com> wrote:
>>
>>>
>>> What does <storeUsage limit="4 mb" name="foo"/> signify ??? does the name
>>> attribute should be the name of the Topic ??? Not clear on that... Thanks
>>>
>>> On 7/28/08, Ramdas Sawant <replyramdas@gmail.com> wrote:
>>>
>>>>
>>>> Hi Rob,
>>>>             I tried using the 5.2 snapshot, but still facing the same
>>>> issue. Below is my activemq.xml
>>>> ///////////////////////////////////
>>>>
>>>> <beans
>>>>  xmlns="http://www.springframework.org/schema/beans"
>>>>  xmlns:amq="http://activemq.apache.org/schema/core"
>>>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>  xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>>>  http://activemq.apache.org/schema/core
>>>> http://activemq.apache.org/schema/core/activemq-core.xsd
>>>>  http://activemq.apache.org/camel/schema/spring
>>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
>>>>
>>>>   <bean
>>>>
>>>> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>>>>
>>>>   <broker xmlns="http://activemq.apache.org/schema/core"
>>>> brokerName="localhost" dataDirectory="${activemq.base}/data">
>>>>
>>>>       <destinationPolicy>
>>>>           <policyMap>
>>>>               <policyEntries>
>>>>                   <policyEntry queue=">" memoryLimit="5mb"/>
>>>>                   <policyEntry topic=">" memoryLimit="1mb">
>>>>                       <dispatchPolicy>
>>>>                           <strictOrderDispatchPolicy/>
>>>>                       </dispatchPolicy>
>>>>                       <subscriptionRecoveryPolicy>
>>>>                           <lastImageSubscriptionRecoveryPolicy/>
>>>>                       </subscriptionRecoveryPolicy>
>>>>                   </policyEntry>
>>>>               </policyEntries>
>>>>           </policyMap>
>>>>       </destinationPolicy>
>>>>
>>>>       <managementContext>
>>>>           <managementContext createConnector="false"/>
>>>>       </managementContext>
>>>>
>>>>       <networkConnectors>
>>>>           <networkConnector name="default-nc"
>>>> uri="multicast://default"/>
>>>>       </networkConnectors>
>>>>
>>>>       <persistenceAdapter>
>>>>           <amqPersistenceAdapter syncOnWrite="false"
>>>> directory="${activemq.base}/data" maxFileLength="2 mb"
>>>> maxReferenceFileLength="1mb"/>
>>>>       </persistenceAdapter>
>>>>
>>>>       <sslContext>
>>>>           <sslContext keyStore="file:${activemq.base}/conf/broker.ks"
>>>> keyStorePassword="password"
>>>> trustStore="file:${activemq.base}/conf/broker.ts"
>>>> trustStorePassword="password"/>
>>>>       </sslContext>
>>>>
>>>>       <!--  The maximum about of space the broker will use before
>>>> slowing down producers -->
>>>>       <systemUsage>
>>>>           <systemUsage>
>>>>               <memoryUsage>
>>>>                   <memoryUsage limit="3 mb"/>
>>>>               </memoryUsage>
>>>>               <storeUsage>
>>>>                   <storeUsage limit="4 mb" name="foo"/>
>>>>               </storeUsage>
>>>>               <tempUsage>
>>>>                   <tempUsage limit="5 mb"/>
>>>>               </tempUsage>
>>>>           </systemUsage>
>>>>       </systemUsage>
>>>>
>>>>
>>>>       <transportConnectors>
>>>>           <transportConnector name="openwire"
>>>> uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
>>>>           <transportConnector name="ssl" uri="ssl://localhost:61617"/>
>>>>           <transportConnector name="stomp"
>>>> uri="stomp://localhost:61613"/>
>>>>           <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
>>>>       </transportConnectors>
>>>>
>>>>   </broker>
>>>>
>>>>   <camelContext id="camel" xmlns="
>>>> http://activemq.apache.org/camel/schema/spring">
>>>>
>>>>       <package>org.foo.bar</package>
>>>>
>>>>       <route>
>>>>           <from uri="activemq:example.A"/>
>>>>           <to uri="activemq:example.B"/>
>>>>       </route>
>>>>   </camelContext>
>>>>
>>>>   <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
>>>>       <connectors>
>>>>           <nioConnector port="8161"/>
>>>>       </connectors>
>>>>
>>>>       <handlers>
>>>>           <webAppContext contextPath="/admin"
>>>> resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
>>>>           <webAppContext contextPath="/demo"
>>>> resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true"/>
>>>>           <webAppContext contextPath="/fileserver"
>>>> resourceBase="${activemq.base}/webapps/fileserver"
>>>> logUrlOnStart="true"/>
>>>>       </handlers>
>>>>   </jetty>
>>>>
>>>> </beans>
>>>> ///////////////////////////////////////////////////////
>>>>
>>>> I tried setting both "maxFileLength" and "<storeUsage limit", but i am
>>>> still facing the same issue. My topic is accepting more messages and the
>>>> broker is creating more data files. It is creating datafiles of the size
>>>> specified in the "maxFileLength" attribute. Please help me out with
>>>> issue.
>>>> Let me know if you neeed any more clarification. Thanks in advance.
>>>>
>>>> regards
>>>> Ramdas
>>>>
>>>> On 7/28/08, Ramdas Sawant <replyramdas@gmail.com> wrote:
>>>>
>>>>>
>>>>> Thanks a lot Rob, will get back to you after testing, in case i need
>>>>> any
>>>>> help. Thanks
>>>>>
>>>>> regards
>>>>> Ramdas
>>>>>
>>>>>
>>>>> On 7/28/08, Rob Davies <rajdavies@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 28 Jul 2008, at 07:20, Ramdas Sawant wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>>>        I am exploring AMQ Message Store of ActiveMQ. I need to
know
>>>>>>> can
>>>>>>> i limit the storage size of message store. I mean my topic should
not
>>>>>>> accept
>>>>>>> messages if a certain size of stored messages is reached on disk.
How
>>>>>>> can i
>>>>>>> configure this ?
>>>>>>>        The attribute maxFileLength of tag "amqPersistenceAdapter"
>>>>>>> only
>>>>>>> limits the size of one file. I am getting multiple files of the
size
>>>>>>> specified by maxFileLength  attribute.  How can i limit this
>>>>>>> continuous
>>>>>>> file
>>>>>>> generation. Let me know if the question is not that clear, or
need
>>>>>>> any
>>>>>>> more
>>>>>>> explaination. I am really stuck here... Thanks in advance....
>>>>>>>
>>>>>>>
>>>>>>> regards
>>>>>>> Ramdas
>>>>>>>
>>>>>>> --
>>>>>>> If you think, "you can", you can
>>>>>>> If you think, "you can't", you are right
>>>>>>>
>>>>>>>
>>>>>> You can set the limit using store limit in the ActiveMQ configuration.
>>>>>> There was a bug in this that's been fixed in trunk - so use a 5.2
>>>>>> snapshot
>>>>>>
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> Rob
>>>>>>
>>>>>> http://open.iona.com/products/enterprise-activemq
>>>>>> http://rajdavies.blogspot.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> If you think, "you can", you can
>>>>> If you think, "you can't", you are right
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> If you think, "you can", you can
>>>> If you think, "you can't", you are right
>>>>
>>>>
>>>
>>>
>>> --
>>> If you think, "you can", you can
>>> If you think, "you can't", you are right
>>>
>>>
>>
>>
>> --
>> If you think, "you can", you can
>> If you think, "you can't", you are right
>>
>
>


-- 
If you think, "you can", you can
If you think, "you can't", you are right

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message