chenta lee wrote:
I already add an option to let user decide whether parse the content or
not.
setting.arguments.setInt("qpid.selector_parse_content", 1);

set qpid.selector_parse_content to 1 will enable broker to parse the message
content, vice versa.
Does your code require the user to specify whether to parse the content? I'd rather do this automatically so it is always consistent. Parse the message if and only if the query requires it.

After you prepare the query, you can ask XQilla if it needs to access the context item. If it does not, then it does not need to query the content. Look at the code for XmlExchange::bind, where I do this. This code is a bit dense, so let me spell out a few steps:

Parse the query:

Query query(xqilla.parse(X(queryText.c_str())));

Then ask if the main body of the query uses the context (which is equivalent to the message body in this environmetn):

if (query->getQueryBody()->getStaticAnalysis().areContextFlagsUsed()) {
                   binding->parse_message_content = true;
}

If the main body of the query does not use the context, it's still possible that a global variable does, so let's check that too:

GlobalVariables &vars = const_cast<GlobalVariables&>(query->getVariables());
for(GlobalVariables::iterator it = vars.begin(); it != vars.end(); ++it) {
   if ((*it)->getStaticAnalysis().areContextFlagsUsed()) {
          binding->parse_message_content = true;
          break;
   }
}

In the XML Exchange, a query has only one module, it can't import libraries. If it could, I would have to check each module this way.

Hope this is helpful!

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to