You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2009/01/13 07:54:59 UTC

[jira] Commented: (CAMEL-1249) MailConfiguration injected into MailComponent by Spring is ignored.

    [ https://issues.apache.org/activemq/browse/CAMEL-1249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=48635#action_48635 ] 

Claus Ibsen commented on CAMEL-1249:
------------------------------------

Thanks for reporting this. I have fixed it.

About the last one using your own component. You need to set the mail configuration to ignore scheme
   <property name="ignoreSchemeUri"><value>true</value></property>

And then "mailbox" needs to be added as a Component. That is easy from Java, but in Spring there might be some component XML tag to declare this.
If not then I think we need it.

> MailConfiguration injected into MailComponent by Spring is ignored.
> -------------------------------------------------------------------
>
>                 Key: CAMEL-1249
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1249
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.4.0, 1.5.0
>         Environment: Camel
>            Reporter: Michael Chen
>            Assignee: Claus Ibsen
>             Fix For: 1.5.1, 2.0.0
>
>
> A Camel org.apache.camel.component.mail.MailComponent is configured via Spring as:
> {code}
> <bean id="mailbox" class="org.apache.camel.component.mail.MailComponent">
>   <property name="configuration">
>     <bean id="mailbox_config" class="org.apache.camel.component.mail.MailConfiguration">
>       <property name="protocol"><value>pop3</value></property>
>       <property name="host"><value>mail.abc.com</value></property>
>       <property name="username"><value>test</value></property>
>       <property name="password"><value>test</value></property>
>     </bean>
>   </property>
> </bean>
> {code}
> It is silly to use the hard-coded URI in Java code to create a mail endpoint. Instead I want to use the above method to specify everything (I mean everything) about how to access a mail server (send or receive) in different deployments.  Up to Camel 1.5, line 73 of MailComponent.createEndpoint() ignored the MailConfiguration variable MailComponent.configuration and created a new one to parse the URI. This defeats the Spring injection above, which is recommended by Camel's own User's Guide.
> Line 73 and 74 should be changed from:
> {quote}
>         MailConfiguration config = new MailConfiguration();
>         config.configure(url);
> {quote}
> to
> {quote}
>         configuration.configure(url);
> {quote}
> In addition, if the uri parameter equals the component name, createEndpoint() should not parse it at all, so that the following route builder will create the mail endpoint solely according to the Spring injection of MailConfiguration:
> {quote}
>     from("mailbox").to("my_queue");
> {quote}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.