Discussion:
browse functionality for jms queue
David Dossot
2012-06-13 17:20:33 UTC
Permalink
I would:
<br />
- clone JmsMessageRequester into JmsMessageBrowser,
<br />
- replace the receive operations with browse operations,
<br />
- create a JmsMessageBrowserFactory inspired by JmsMessageRequesterFactory but that creates JmsMessageBrowser instances,
<br />
- register JmsMessageBrowserFactory on the JmsConnector by calling setRequesterFactory with Spring,
<br />
- then use the MuleClient to issue request() operations on this connector, which will end up performing browse on the queue instead of consume.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-15 12:46:30 UTC
Permalink
hi david,
<br /><br />
Thanks for the cue, I have cloned and created the JmsMessageBrowser and JmsMessageBrowserFactory which creates a JmsMessageBrowser, but I am unable to get hold on to the "JmsMessageBrowserFactory on the JmsConnector by calling setRequesterFactory with Spring" part , how should i do that ?
<br /><br />
thanks again

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2012-06-15 16:22:30 UTC
Permalink
This:
<br />
<code>
<br />
&lt;jms:connector name=&quot;OracleAQConnector&quot; specification=&quot;1&#46;1&quot; &#46;&#46;&#46; &gt;
<br />
&lt;spring:property name=&quot;requesterFactory&quot;&gt;
<br />
&lt;spring:bean class=&quot;your&#46;JmsMessageBrowserFactory&quot; &#47;&gt;
<br />
&lt;&#47;spring:property&gt;
<br />
&lt;&#47;jms:connector&gt;
<br />
</code>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-18 10:12:32 UTC
Permalink
hi,
<br />
I have the replaced receive operations with browse operations in the JmsMessageBrowser like this:
<br />
<code>
<br />
@Override
<br />
protected MuleMessage doRequest(long timeout) throws Exception {
<br />
Session session=null;
<br />
QueueBrowser browser=null;
<br />
boolean cleanupListenerRegistered=false;
<br />
try{
<br />
final boolean topic = connector&#46;getTopicResolver()&#46;isTopic(endpoint);
<br />
JmsSupport support = connector&#46;getJmsSupport();
<br />
final TransactionConfig transactionConfig = endpoint&#46;getTransactionConfig();
<br />
final Transaction tx = TransactionCoordination&#46;getInstance()&#46;getTransaction();
<br />
boolean transacted = transactionConfig !=null &amp;&amp; transactionConfig&#46;isTransacted();
<br />
session=connector&#46;getSession(transacted, topic);
<br />
if(transacted &amp;&amp; !tx&#46;isXA()){
<br />
final Session finalSession=session;
<br />
getConnector()&#46;getMuleContext()&#46;registerListener(new TransactionNotificationListener&lt;TransactionNotification&gt;() {
<br />
public void onNotification(TransactionNotification txNotification){
<br />
final int txAction = txNotification&#46;getAction();
<br />
final String txId=txNotification&#46;getTransactionStringId();
<br />
if((txAction==TransactionNotification&#46;TRANSACTION_COMMITTED
<br />
|| txAction==TransactionNotification&#46;TRANSACTION_ROLLEDBACK)
<br />
&amp;&amp; txId&#46;equals(tx&#46;getId())){
<br />
connector&#46;closeQuietly(finalSession);
<br />
}
<br />
}
<br /><br />
},tx&#46;getId());
<br />
cleanupListenerRegistered=true;
<br />
}
<br /><br />
Destination dest=support&#46;createDestination(session,endpoint);
<br />
&#47;&#47;Extract jms selector
<br />
String selector = null;
<br />
JmsSelectorFilter selectorFilter = connector&#46;getSelector(endpoint);
<br />
if (selectorFilter != null)
<br />
{
<br />
final String expressionTemplate = selectorFilter&#46;getExpression();
<br />
if (StringUtils&#46;isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector&#46;getMuleContext()&#46;getExpressionManager()&#46;parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
else if (endpoint&#46;getProperties() != null)
<br />
{
<br />
&#47;&#47; still allow the selector to be set as a property on the endpoint
<br />
&#47;&#47; to be backward compatable
<br />
final String expressionTemplate = (String) endpoint&#46;getProperty(JmsConstants&#46;JMS_SELECTOR_PROPERTY);
<br />
if (StringUtils&#46;isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector&#46;getMuleContext()&#46;getExpressionManager()&#46;parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
String tempDurable = (String) endpoint&#46;getProperties()&#46;get(JmsConstants&#46;DURABLE_PROPERTY);
<br />
boolean durable = connector&#46;isDurable();
<br />
if (tempDurable != null)
<br />
{
<br />
durable = Boolean&#46;valueOf(tempDurable);
<br />
}
<br /><br />
&#47;&#47; Get the durable subscriber name if there is one
<br />
String durableName = (String) endpoint&#46;getProperties()&#46;get(JmsConstants&#46;DURABLE_NAME_PROPERTY);
<br />
if (durableName == null &amp;&amp; durable &amp;&amp; topic)
<br />
{
<br />
durableName = &quot;mule&#46;&quot; + connector&#46;getName() + &quot;&#46;&quot; + endpoint&#46;getEndpointURI()&#46;getAddress();
<br />
if (logger&#46;isDebugEnabled())
<br />
{
<br />
logger&#46;debug(&quot;Jms Connector for this receiver is durable but no durable name has been specified&#46; Defaulting to: &quot;
<br />
+ durableName);
<br />
}
<br />
}
<br /><br />
&#47;&#47; create browser
<br />
Queue q=(Queue)support&#46;createDestination(session, endpoint);
<br />
browser=session&#46;createBrowser(q);
<br />
&#47;&#47; browse message
<br />
@SuppressWarnings(&quot;rawtypes&quot;)
<br />
Enumeration e = browser&#46;getEnumeration();
<br />
if (null != e) {
<br />
while (e&#46;hasMoreElements()) {
<br />
Message message = (Message)e&#46;nextElement();
<br />
return createMuleMessage(message, endpoint&#46;getEncoding());
<br /><br />
}
<br />
}
<br />
return null;
<br />
}finally{
<br />
if(!cleanupListenerRegistered){
<br />
connector&#46;closeSessionIfNoTransactionActive(session);
<br />
}
<br />
}
<br />
}
<br />
</code>
<br />
and the JmsMessageBrowserFactory is :
<br />
<code>
<br />
public class JmsMessageBrowserFactory extends AbstractMessageBrowserFactory{
<br />
public MessageBrowser create(InboundEndpoint endpoint) throws MuleException{
<br />
return new JmsMessageBrowser(endpoint);
<br />
}
<br /><br />
}
<br />
</code>
<br /><br />
and the config i have :
<br />
<code>
<br />
&lt;jms:connector name=&quot;OracleAQConnector&quot; username=&quot;**&quot; password=&quot;**&quot; connectionFactory-ref=&quot;connFactory&quot; doc:name=&quot;JMS&quot;&gt;
<br />
&lt;spring:property name=&quot;requesterFactory&quot;&gt;
<br />
&lt;spring:bean class=&quot;JmsMessageBrowserFactory&quot; &#47;&gt;
<br />
&lt;&#47;spring:property&gt;
<br />
&lt;&#47;jms:connector&gt;
<br />
</code>
<br /><br />
and the error I receive is a type cast error :
<br />
<code>
<br />
WARN 2012-06-18 15:02:07,421 [main] org&#46;mule&#46;config&#46;spring&#46;parsers&#46;assembly&#46;DefaultBeanAssembler: Cannot assign class org&#46;mule&#46;transport&#46;jms&#46;JmsConnector to interface org&#46;mule&#46;api&#46;AnnotatedObject
<br />
WARN 2012-06-18 15:02:07,437 [main] org&#46;mule&#46;config&#46;spring&#46;parsers&#46;assembly&#46;DefaultBeanAssembler: Cannot assign class java&#46;lang&#46;Object to interface org&#46;mule&#46;api&#46;AnnotatedObject
<br />
INFO 2012-06-18 15:02:08,890 [main] org&#46;mule&#46;lifecycle&#46;AbstractLifecycleManager: Initialising model: _muleSystemModel
<br />
INFO 2012-06-18 15:02:09,031 [main] org&#46;mule&#46;lifecycle&#46;AbstractLifecycleManager: Disposing model: _muleSystemModel
<br />
ERROR 2012-06-18 15:02:09,046 [main] org&#46;mule&#46;tooling&#46;server&#46;application&#46;ApplicationDeployer: null
<br />
java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;springframework&#46;beans&#46;TypeConverterDelegate&#46;convertIfNecessary(TypeConverterDelegate&#46;java:231)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertIfNecessary(BeanWrapperImpl&#46;java:447)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertForProperty(BeanWrapperImpl&#46;java:499)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertForProperty(BeanWrapperImpl&#46;java:493)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;convertForProperty(AbstractAutowireCapableBeanFactory&#46;java:1363)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;applyPropertyValues(AbstractAutowireCapableBeanFactory&#46;java:1322)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;populateBean(AbstractAutowireCapableBeanFactory&#46;java:1076)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;doCreateBean(AbstractAutowireCapableBeanFactory&#46;java:517)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;createBean(AbstractAutowireCapableBeanFactory&#46;java:456)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory$1&#46;getObject(AbstractBeanFactory&#46;java:291)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;DefaultSingletonBeanRegistry&#46;getSingleton(DefaultSingletonBeanRegistry&#46;java:222)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory&#46;doGetBean(AbstractBeanFactory&#46;java:288)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory&#46;getBean(AbstractBeanFactory&#46;java:190)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;DefaultListableBeanFactory&#46;preInstantiateSingletons(DefaultListableBeanFactory&#46;java:574)
<br />
at org&#46;springframework&#46;context&#46;support&#46;AbstractApplicationContext&#46;finishBeanFactoryInitialization(AbstractApplicationContext&#46;java:895)
<br />
at org&#46;springframework&#46;context&#46;support&#46;AbstractApplicationContext&#46;refresh(AbstractApplicationContext&#46;java:425)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringRegistry&#46;doInitialise(SpringRegistry&#46;java:89)
<br />
at org&#46;mule&#46;registry&#46;AbstractRegistry&#46;initialise(AbstractRegistry&#46;java:109)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringXmlConfigurationBuilder&#46;createSpringRegistry(SpringXmlConfigurationBuilder&#46;java:116)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringXmlConfigurationBuilder&#46;doConfigure(SpringXmlConfigurationBuilder&#46;java:73)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:46)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractResourceConfigurationBuilder&#46;configure(AbstractResourceConfigurationBuilder&#46;java:78)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AutoConfigurationBuilder&#46;autoConfigure(AutoConfigurationBuilder&#46;java:101)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AutoConfigurationBuilder&#46;doConfigure(AutoConfigurationBuilder&#46;java:57)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:46)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractResourceConfigurationBuilder&#46;configure(AbstractResourceConfigurationBuilder&#46;java:78)
<br />
at org&#46;mule&#46;context&#46;DefaultMuleContextFactory&#46;createMuleContext(DefaultMuleContextFactory&#46;java:80)
<br />
at org&#46;mule&#46;module&#46;launcher&#46;application&#46;DefaultMuleApplication&#46;init(DefaultMuleApplication&#46;java:203)
<br />
at org&#46;mule&#46;module&#46;launcher&#46;application&#46;ApplicationWrapper&#46;init(ApplicationWrapper&#46;java:64)
<br />
at org&#46;mule&#46;tooling&#46;server&#46;application&#46;ApplicationDeployer&#46;main(ApplicationDeployer&#46;java:45)
<br />
Exception in thread &quot;main&quot; org&#46;mule&#46;module&#46;launcher&#46;DeploymentInitException: IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;mule&#46;module&#46;launcher&#46;application&#46;DefaultMuleApplication&#46;init(DefaultMuleApplication&#46;java:215)
<br />
at org&#46;mule&#46;module&#46;launcher&#46;application&#46;ApplicationWrapper&#46;init(ApplicationWrapper&#46;java:64)
<br />
at org&#46;mule&#46;tooling&#46;server&#46;application&#46;ApplicationDeployer&#46;main(ApplicationDeployer&#46;java:45)
<br />
Caused by: org&#46;mule&#46;api&#46;config&#46;ConfigurationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org&#46;springframework&#46;beans&#46;ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory' for property 'requesterFactory'; nested exception is java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found (org&#46;mule&#46;api&#46;lifecycle&#46;InitialisationException) (org&#46;mule&#46;api&#46;c
onfig&#46;ConfigurationException)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:52)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractResourceConfigurationBuilder&#46;configure(AbstractResourceConfigurationBuilder&#46;java:78)
<br />
at org&#46;mule&#46;context&#46;DefaultMuleContextFactory&#46;createMuleContext(DefaultMuleContextFactory&#46;java:80)
<br />
at org&#46;mule&#46;module&#46;launcher&#46;application&#46;DefaultMuleApplication&#46;init(DefaultMuleApplication&#46;java:203)
<br />
&#46;&#46;&#46; 2 more
<br />
Caused by: org&#46;mule&#46;api&#46;config&#46;ConfigurationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org&#46;springframework&#46;beans&#46;ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory' for property 'requesterFactory'; nested exception is java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found (org&#46;mule&#46;api&#46;lifecycle&#46;InitialisationException)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:52)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractResourceConfigurationBuilder&#46;configure(AbstractResourceConfigurationBuilder&#46;java:78)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AutoConfigurationBuilder&#46;autoConfigure(AutoConfigurationBuilder&#46;java:101)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AutoConfigurationBuilder&#46;doConfigure(AutoConfigurationBuilder&#46;java:57)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:46)
<br />
&#46;&#46;&#46; 5 more
<br />
Caused by: org&#46;mule&#46;api&#46;lifecycle&#46;InitialisationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org&#46;springframework&#46;beans&#46;ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory' for property 'requesterFactory'; nested exception is java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;mule&#46;registry&#46;AbstractRegistry&#46;initialise(AbstractRegistry&#46;java:117)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringXmlConfigurationBuilder&#46;createSpringRegistry(SpringXmlConfigurationBuilder&#46;java:116)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringXmlConfigurationBuilder&#46;doConfigure(SpringXmlConfigurationBuilder&#46;java:73)
<br />
at org&#46;mule&#46;config&#46;builders&#46;AbstractConfigurationBuilder&#46;configure(AbstractConfigurationBuilder&#46;java:46)
<br />
&#46;&#46;&#46; 9 more
<br />
Caused by: org&#46;springframework&#46;beans&#46;factory&#46;BeanCreationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org&#46;springframework&#46;beans&#46;ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory' for property 'requesterFactory'; nested exception is java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;doCreateBean(AbstractAutowireCapableBeanFactory&#46;java:527)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;createBean(AbstractAutowireCapableBeanFactory&#46;java:456)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory$1&#46;getObject(AbstractBeanFactory&#46;java:291)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;DefaultSingletonBeanRegistry&#46;getSingleton(DefaultSingletonBeanRegistry&#46;java:222)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory&#46;doGetBean(AbstractBeanFactory&#46;java:288)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractBeanFactory&#46;getBean(AbstractBeanFactory&#46;java:190)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;DefaultListableBeanFactory&#46;preInstantiateSingletons(DefaultListableBeanFactory&#46;java:574)
<br />
at org&#46;springframework&#46;context&#46;support&#46;AbstractApplicationContext&#46;finishBeanFactoryInitialization(AbstractApplicationContext&#46;java:895)
<br />
at org&#46;springframework&#46;context&#46;support&#46;AbstractApplicationContext&#46;refresh(AbstractApplicationContext&#46;java:425)
<br />
at org&#46;mule&#46;config&#46;spring&#46;SpringRegistry&#46;doInitialise(SpringRegistry&#46;java:89)
<br />
at org&#46;mule&#46;registry&#46;AbstractRegistry&#46;initialise(AbstractRegistry&#46;java:109)
<br />
&#46;&#46;&#46; 12 more
<br />
Caused by: org&#46;springframework&#46;beans&#46;ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory' for property 'requesterFactory'; nested exception is java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertIfNecessary(BeanWrapperImpl&#46;java:462)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertForProperty(BeanWrapperImpl&#46;java:499)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertForProperty(BeanWrapperImpl&#46;java:493)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;convertForProperty(AbstractAutowireCapableBeanFactory&#46;java:1363)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;applyPropertyValues(AbstractAutowireCapableBeanFactory&#46;java:1322)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;populateBean(AbstractAutowireCapableBeanFactory&#46;java:1076)
<br />
at org&#46;springframework&#46;beans&#46;factory&#46;support&#46;AbstractAutowireCapableBeanFactory&#46;doCreateBean(AbstractAutowireCapableBeanFactory&#46;java:517)
<br />
&#46;&#46;&#46; 22 more
<br />
Caused by: java&#46;lang&#46;IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org&#46;mule&#46;api&#46;transport&#46;MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org&#46;springframework&#46;beans&#46;TypeConverterDelegate&#46;convertIfNecessary(TypeConverterDelegate&#46;java:231)
<br />
at org&#46;springframework&#46;beans&#46;BeanWrapperImpl&#46;convertIfNecessary(BeanWrapperImpl&#46;java:447)
<br />
&#46;&#46;&#46; 28 more
<br /><br />
</code>
<br /><br />
ami i missing type casting somewhere ?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2012-06-18 14:42:31 UTC
Permalink
I see:
<br />
<code>JmsMessageBrowserFactory extends AbstractMessageBrowserFactory</code>
<br /><br />
I do not know the AbstractMessageBrowserFactory type: does it extend <a href="http://www.mulesoft.org/docs/site/current3/apidocs/index.html?org/mule/transport/AbstractMessageRequesterFactory.html" rel="nofollow">http://www.mulesoft.org/docs/site/cur...</a> ?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-19 07:37:34 UTC
Permalink
hi,
<br />
I have made some class level changes, now am able to compile and run the same , but again the messages are consumed, instead of being browsed.the sop's are not fired also....
<br />
The JmsMessageBrowser:
<br />
<code>
<br />
public class JmsMessageBrowser extends AbstractMessageRequester{
<br />
:
<br />
:
<br />
@Override
<br />
protected MuleMessage doRequest(long timeout) throws Exception {
<br />
Session session=null;
<br />
QueueBrowser browser=null;
<br />
boolean cleanupListenerRegistered=false;
<br />
System&#46;out&#46;println(&quot;***************************13214234324************&quot;);
<br />
try{
<br />
final boolean topic = connector&#46;getTopicResolver()&#46;isTopic(endpoint);
<br />
JmsSupport support = connector&#46;getJmsSupport();
<br />
final TransactionConfig transactionConfig = endpoint&#46;getTransactionConfig();
<br />
final Transaction tx = TransactionCoordination&#46;getInstance()&#46;getTransaction();
<br />
boolean transacted = transactionConfig !=null &amp;&amp; transactionConfig&#46;isTransacted();
<br />
session=connector&#46;getSession(transacted, topic);
<br />
if(transacted &amp;&amp; !tx&#46;isXA()){
<br />
final Session finalSession=session;
<br />
getConnector()&#46;getMuleContext()&#46;registerListener(new TransactionNotificationListener&lt;TransactionNotification&gt;() {
<br />
public void onNotification(TransactionNotification txNotification){
<br />
final int txAction = txNotification&#46;getAction();
<br />
final String txId=txNotification&#46;getTransactionStringId();
<br />
if((txAction==TransactionNotification&#46;TRANSACTION_COMMITTED
<br />
|| txAction==TransactionNotification&#46;TRANSACTION_ROLLEDBACK)
<br />
&amp;&amp; txId&#46;equals(tx&#46;getId())){
<br />
connector&#46;closeQuietly(finalSession);
<br />
}
<br />
}
<br /><br />
},tx&#46;getId());
<br />
cleanupListenerRegistered=true;
<br />
}
<br /><br />
Destination dest=support&#46;createDestination(session,endpoint);
<br />
&#47;&#47;Extract jms selector
<br />
String selector = null;
<br />
JmsSelectorFilter selectorFilter = connector&#46;getSelector(endpoint);
<br />
if (selectorFilter != null)
<br />
{
<br />
final String expressionTemplate = selectorFilter&#46;getExpression();
<br />
if (StringUtils&#46;isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector&#46;getMuleContext()&#46;getExpressionManager()&#46;parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
else if (endpoint&#46;getProperties() != null)
<br />
{
<br />
&#47;&#47; still allow the selector to be set as a property on the endpoint
<br />
&#47;&#47; to be backward compatable
<br />
final String expressionTemplate = (String) endpoint&#46;getProperty(JmsConstants&#46;JMS_SELECTOR_PROPERTY);
<br />
if (StringUtils&#46;isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector&#46;getMuleContext()&#46;getExpressionManager()&#46;parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
String tempDurable = (String) endpoint&#46;getProperties()&#46;get(JmsConstants&#46;DURABLE_PROPERTY);
<br />
boolean durable = connector&#46;isDurable();
<br />
if (tempDurable != null)
<br />
{
<br />
durable = Boolean&#46;valueOf(tempDurable);
<br />
}
<br /><br />
&#47;&#47; Get the durable subscriber name if there is one
<br />
String durableName = (String) endpoint&#46;getProperties()&#46;get(JmsConstants&#46;DURABLE_NAME_PROPERTY);
<br />
if (durableName == null &amp;&amp; durable &amp;&amp; topic)
<br />
{
<br />
durableName = &quot;mule&#46;&quot; + connector&#46;getName() + &quot;&#46;&quot; + endpoint&#46;getEndpointURI()&#46;getAddress();
<br />
if (logger&#46;isDebugEnabled())
<br />
{
<br />
logger&#46;debug(&quot;Jms Connector for this receiver is durable but no durable name has been specified&#46; Defaulting to: &quot;
<br />
+ durableName);
<br />
}
<br />
}
<br /><br />
&#47;&#47; create browser
<br />
Queue q=(Queue)support&#46;createDestination(session, endpoint);
<br />
browser=session&#46;createBrowser(q);
<br />
&#47;&#47; browse message
<br />
@SuppressWarnings(&quot;rawtypes&quot;)
<br />
Enumeration e = browser&#46;getEnumeration();
<br />
if (null != e) {
<br />
while (e&#46;hasMoreElements()) {
<br />
Message message = (Message)e&#46;nextElement();
<br />
return createMuleMessage(message, endpoint&#46;getEncoding());
<br />
}
<br />
}
<br />
return null;
<br />
}finally{
<br />
if(!cleanupListenerRegistered){
<br />
connector&#46;closeSessionIfNoTransactionActive(session);
<br />
}
<br />
}
<br />
}
<br /><br />
:
<br />
:
<br />
}
<br />
</code>
<br />
The JmsMessageBrowserFactory :
<br />
<code>
<br />
public class JmsMessageBrowserFactory extends AbstractMessageBrowserFactory{
<br />
public JmsMessageBrowser create(InboundEndpoint endpoint) throws MuleException{
<br />
System&#46;out&#46;println(&quot;***************************13214234324 Factory************&quot;);
<br />
return new JmsMessageBrowser(endpoint);
<br />
}
<br /><br />
}
<br />
</code>
<br />
The AbstractMessageBrowserFactory (as requested is as follows) although JmsMessageBrowserFactory can be straight away be inherited from the AbstractMessageRequesterFactory....
<br />
<code>
<br />
public abstract class AbstractMessageBrowserFactory extends AbstractMessageRequesterFactory{
<br />
public AbstractMessageBrowserFactory() {
<br />
&#47;&#47; TODO Auto-generated constructor stub
<br />
super();
<br />
}
<br /><br />
public boolean isCreateBrowserPerRequest()
<br />
{
<br />
return false;
<br />
}
<br /><br />
public abstract MessageRequester create(InboundEndpoint endpoint) throws MuleException;
<br /><br />
public void activate(InboundEndpoint endpoint, MessageRequester browser) throws MuleException
<br />
{
<br />
browser&#46;activate();
<br />
}
<br /><br />
public void destroy(InboundEndpoint endpoint, MessageRequester requester)
<br />
{
<br />
requester&#46;dispose();
<br />
}
<br /><br />
public void passivate(InboundEndpoint endpoint, MessageRequester requester)
<br />
{
<br />
requester&#46;passivate();
<br />
}
<br /><br />
public boolean validate(InboundEndpoint endpoint, MessageRequester requester)
<br />
{
<br /><br />
return (!this&#46;isCreateBrowserPerRequest() &amp;&amp; requester&#46;validate());
<br />
}
<br /><br />
@Override
<br />
public String toString()
<br />
{
<br />
final StringBuffer sb = new StringBuffer(60);
<br />
sb&#46;append(ClassUtils&#46;getSimpleName(this&#46;getClass()));
<br />
sb&#46;append(&quot;{this=&quot;)&#46;append(Integer&#46;toHexString(System&#46;identityHashCode(this)));
<br />
sb&#46;append(&quot;, createBrowserPerRequest=&quot;)&#46;append(this&#46;isCreateBrowserPerRequest());
<br />
sb&#46;append('}');
<br />
return sb&#46;toString();
<br />
}
<br /><br />
}
<br />
</code>
<br />
The config is still the same, I am using the JmsInbound endpoint and using the jmsConnector on it.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2012-06-19 08:25:32 UTC
Permalink
Message requesters (and your case browsers) are not related to inbound endpoints but, as I said in my original post, "use the MuleClient to issue request() operations on this connector, which will end up performing browse on the queue instead of consume.".

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-19 11:28:32 UTC
Permalink
I have used a main method to acheive this :
<br />
<code>
<br />
public static void main(String args[]) throws MuleException,Exception{
<br />
AutoConfigurationBuilder configbuilder = new AutoConfigurationBuilder(&quot;bequeue&#46;xml&quot;);
<br />
DefaultMuleConfiguration muleConfig = new DefaultMuleConfiguration();
<br />
muleConfig&#46;setId(&quot;MY_SERVER_ID_1&quot;);
<br />
MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
<br />
contextBuilder&#46;setMuleConfiguration(muleConfig);
<br />
MuleContext muleContext = new DefaultMuleContextFactory()&#46;createMuleContext(configbuilder, contextBuilder);
<br />
muleContext&#46;start();
<br />
MuleClient client = new MuleClient(muleContext);
<br />
MuleMessage message = client&#46;request(&quot;OracleAQConnector&quot;, 5000);
<br />
System&#46;out&#46;println(message&#46;getPayloadAsString());
<br /><br />
}
<br />
</code>
<br /><br />
it gives me a malformed endpoint exception , i did a muleclient request on the JmsConnector,
<br />
<code>
<br />
log4j:WARN No appenders could be found for logger (org&#46;mule&#46;context&#46;DefaultMuleContextBuilder)&#46;
<br />
log4j:WARN Please initialize the log4j system properly&#46;
<br />
Exception in thread &quot;main&quot; java&#46;lang&#46;IllegalStateException: Bad endpoint configuration
<br />
at org&#46;mule&#46;endpoint&#46;URIBuilder&#46;getEndpoint(URIBuilder&#46;java:221)
<br />
at org&#46;mule&#46;endpoint&#46;AbstractEndpointBuilder&#46;getProperties(AbstractEndpointBuilder&#46;java:469)
<br />
at org&#46;mule&#46;endpoint&#46;AbstractEndpointBuilder&#46;prepareToBuildEndpoint(AbstractEndpointBuilder&#46;java:312)
<br />
at org&#46;mule&#46;endpoint&#46;AbstractEndpointBuilder&#46;doBuildInboundEndpoint(AbstractEndpointBuilder&#46;java:186)
<br />
at org&#46;mule&#46;endpoint&#46;AbstractEndpointBuilder&#46;buildInboundEndpoint(AbstractEndpointBuilder&#46;java:117)
<br />
at org&#46;mule&#46;endpoint&#46;DefaultEndpointFactory&#46;getInboundEndpoint(DefaultEndpointFactory&#46;java:83)
<br />
at org&#46;mule&#46;endpoint&#46;DefaultEndpointFactory&#46;getInboundEndpoint(DefaultEndpointFactory&#46;java:51)
<br />
at org&#46;mule&#46;module&#46;client&#46;MuleClient&#46;getInboundEndpoint(MuleClient&#46;java:718)
<br />
at org&#46;mule&#46;module&#46;client&#46;MuleClient&#46;request(MuleClient&#46;java:650)
<br />
at Client&#46;main(Client&#46;java:30)
<br />
Caused by: org&#46;mule&#46;api&#46;endpoint&#46;MalformedEndpointException: The endpoint &quot;OracleAQConnector&quot; is malformed and cannot be parsed&#46; If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the &quot;ref&quot; attribute)&#46; Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead&#46;
<br />
at org&#46;mule&#46;endpoint&#46;MuleEndpointURI&#46;preprocessUri(MuleEndpointURI&#46;java:201)
<br />
at org&#46;mule&#46;endpoint&#46;MuleEndpointURI&#46;&lt;init&gt;(MuleEndpointURI&#46;java:139)
<br />
at org&#46;mule&#46;endpoint&#46;URIBuilder&#46;getEndpoint(URIBuilder&#46;java:216)
<br />
&#46;&#46;&#46; 9 more
<br /><br />
</code>
<br /><br />
have a doubt , that if i do not have inbound endpoints where do i configure the queue name ?,

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2012-06-19 12:49:32 UTC
Permalink
Eh eh, you clearly haven't read Mule in Action :)
<br /><br />
Try:
<br />
<code>MuleMessage message = client&#46;request(&quot;jms:&#47;&#47;queueName&amp;connector=OracleAQConnector&quot;, 5000);</code>
<br />
replacing "queueName" with whatever you need.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-20 08:18:32 UTC
Permalink
thanks for help .... promise to work on the mule in action before the actual assignment starts... ;-), have slightly tweaked your suggestion as it was throwing an exception (queue not found) :
<br />
<code>
<br />
MuleMessage message = client&#46;request(&quot;jms:&#47;&#47;SUB2_NTRIG?connector=OracleAQConnector&quot;, 500);
<br />
</code>
<br />
instead of :
<br />
<code>
<br />
MuleMessage message = client&#46;request(&quot;jms:&#47;&#47;SUB2_NTRIG&amp;connector=OracleAQConnector&quot;, 500);
<br />
</code>
<br />
no errors , runs peacefully, can get the message payload but the message is consumed !!

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2012-06-20 08:38:32 UTC
Permalink
Are JmsMessageBrowserFactory and JmsMessageBrowser used at all?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
riba riba
2012-06-20 10:32:32 UTC
Permalink
i guess .. they are not invoked as the sop's i had put in , as I had mentioned earlier is not fired..

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...