Hi Tim,

The issue is resolved, It was mysql quey block which was throwing the
exception, but it was being catched in wrong catch block.

Thanks,
Manu


Timothy Bish wrote:
> 
> On Thu, 2010-07-01 at 07:18 -0700, manua wrote:
>> Hi Tim,
>> 
>> Please find below my code snippet,
>> 
>> int get_ref_data(string s){
>>      mysqlpp::Connection conn;
>>      if (conn.connect("Database", "localhost", "proddbuser", "proddblander"))
>> {
>>              cout << "DB Connected" << endl;
>>              mysqlpp::Query query = conn.query();
>>              query << "SELECT * from table where symbol=" << s << " and
>> date='20100628'";
>>              if (mysqlpp::StoreQueryResult res = query.store()) {
>>                      cout << "Query Data:" << endl;
>>                      for (size_t i = 0; i < res.num_rows(); ++i) {
>>                              cout << '\t' << res[i][0] << " , "<< res[i][1] 
>> << " , "<< res[i][2]
>> << "
>> , "<< res[i][3] << " , "<< res[i][4] << endl;
>>                      }
>>              }else{
>>                      cout << "Couldn't execute the query";
>>              }
>>      }
>>      cout <<endl;
>>      return 1;
>> }
>> 
>> void onRequest( void *msg ){
>>      const TextMessage* txtMessage = dynamic_cast< const TextMessage* >(
>> (Message *)msg );
>>      string s1 = txtMessage->getText();
>>      istringstream is1(s1);
>>      Stream_reader<istringstream, mValue> reader(is1);
>> 
>>      mValue value;
>>      reader.read_next(value);
>>      mObject& O = value.get_obj();
>> 
>>      for(mObject::iterator it=O.begin();it != O.end();++it){
>>          cout <<endl<< (it)->first;
>>          if(!(it)->first.compare("Portfolio")){
>>              mArray& a = O["Portfolio"].get_array();
>>              for(int i=0;i<a.size();i++){
>>                      mArray& tmp = a[i].get_array();
>>                      cout << endl << "       ";
>>                      string t = tmp[0].get_value<string>();
>>                      get_ref_data(t);
>>                      for(int j=0;j<tmp.size();j++){
>>                              cout <<"  " << tmp[j].get_value<string>();
>>                      }
>>              }
>>          }
>>      }
>> 
>>      txtMessage->acknowledge();
>> 
>> //   testing the slave response part. The same Object is being sent as
>> received.
>>      ofstream os( "json_cpp.txt" );
>>      write_stream( mValue( O ), os, true );
>> 
>>      mObject OR;
>>      OR["response"] = "done";
>>      OR["input"] = O;
>>      string s2 = write_string(mValue( OR ),true);
>> 
>>      destURI = "Data.Response.Q";
>>      respProducer = new clAMQ(brokerURI, destURI);
>>      respProducer->connect();
>>      respProducer->createProducer();
>> 
>>      void *rmsg = respProducer->createTextMessage();
>>      clAMQ::addPayLoadToTextMessage(rmsg,s2);
>>      respProducer->sendMsg(rmsg);
>> }
>> 
>> 
>> In the above function, when get_data() is called, I got the error
>> message.
>> 
> 
> I don't really see much error handling in these methods so it likely
> something in there is throwing an exception, I'd recommend maybe
> stepping through the code with the debugger to see if that's true and if
> so then you can see where its coming from.  
> 
> Regards
> Tim.
> 
>> Please let me your inputs.
>> 
>> Thanks,
>> Manu
>> 
>> 
>> Timothy Bish wrote:
>> > 
>> > On Thu, 2010-07-01 at 06:47 -0700, manua wrote:
>> >> Hi All,
>> >> 
>> >> I am getting the following error, when processing the received
>> message,
>> >> 
>> >> caught unknown exception
>> >>         FILE: activemq/core/ActiveMQConsumer.cpp, LINE: 987
>> >>         FILE: activemq/core/ActiveMQSessionExecutor.cpp, LINE: 133
>> >> 
>> >> My application is divided into three parts,
>> >> 
>> >> 1. On receiving the message, its extracting the test message and
>> passing
>> >> that to json_spirit function. 
>> >> 2. The json spirit function converts the text message to a json and
>> >> extract
>> >> the various vector/map parameters. It then pass the extracted
>> parameter
>> >> to
>> >> the Db Function.
>> >> 3. The Db function takes the string as a input and accordingly fetch
>> the
>> >> data from the db.
>> >> 
>> >> Its working fine till Step 2. In step 3, Db connection is made but the
>> >> moment it hits the query part, I got the above error.
>> >> 
>> >> Am I doing something wrong, or is there a better way to do it.
>> >> Please let me know your inputs.
>> >> 
>> >> Thanks,
>> >> Manu
>> > 
>> > Without seeing the code my first guess would be that your onMessage
>> > method is throwing an exception somewhere in your step three which
>> > propagates back through the ActiveMQConsumer to the
>> > ActiveMQSessionExecutor.  I'd add some more exception handing in you
>> > onMessage handler to see what your code is throwing.
>> > 
>> > Regards
>> > 
>> > -- 
>> > Tim Bish
>> > 
>> > Open Source Integration: http://fusesource.com
>> > ActiveMQ in Action: http://www.manning.com/snyder/
>> > 
>> > Follow me on Twitter: http://twitter.com/tabish121
>> > My Blog: http://timbish.blogspot.com/
>> > 
>> > 
>> > 
>> 
> 
> -- 
> Tim Bish
> 
> Open Source Integration: http://fusesource.com
> ActiveMQ in Action: http://www.manning.com/snyder/
> 
> Follow me on Twitter: http://twitter.com/tabish121
> My Blog: http://timbish.blogspot.com/
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Caught-unknown-exception-in-activeMQConsumer.cpp-tp29045831p29163079.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to