You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bruno Dusausoy <bd...@yp5.be> on 2010/10/18 10:19:00 UTC

Programmatically creating endpoints

Hi,

I have a small application which uses file and mail components.
I pass some endpoints parameters to the application via the 
command-line arguments that are then parsed (thanks to the excellent 
JCommander lib, BTW).
In order to create the routes (and the endpoints) I must concatenate 
some strings.
Is there another way to create endpoints, like programmatically ?

I've been able to successfully create file endpoints entirely 
programmatically thanks to the FileEndpoint class, but I've not been 
able to see a SmtpEndpoint or something similar.

Is the only way of creating endpoints by going through string 
concatenation ?

Regards.
--
Bruno Dusausoy
YP5 Software

--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

Re: AW: Programmatically creating endpoints

Posted by Bruno Dusausoy <bd...@yp5.be>.
On Mon, 18 Oct 2010 10:33:53 +0200, Schneider Christian
<Ch...@enbw.com> wrote:
> Hi Bruno,
> 
> in the case of the mail component the endpoint is called
> MailEndpoint. It will be able to handle the uri prefixes of smtp, pop3
> and imap. As these things are not so well documented in the wiki you
> best look into the respective component source to see how it works
> programmatically. Normally a component is quite small so it is quite
> easy to understand the sources.
> 

Nice !
Actually I was being confused by the Javadoc link which points to Camel
2.2.0 API - without even noticing it :-/ - but didn't see any
MailEndpoint.

Thanks a lot for pointing that out :).

Regards.
-- 
Bruno Dusausoy
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

AW: Programmatically creating endpoints

Posted by Schneider Christian <Ch...@enbw.com>.
Hi Bruno,

in the case of the mail component the endpoint is called MailEndpoint. It will be able to handle the uri prefixes of smtp, pop3 and imap. As these things are not so well documented in the wiki you best look into the respective component source to see how it works programmatically. Normally a component is quite small so it is quite easy to understand the sources.

Best Regards

Christian
 




Christian Schneider
Informationsverarbeitung 
Business Solutions
Handel und Dispatching

Tel : +49-(0)721-63-15482

EnBW Systeme Infrastruktur Support GmbH
Sitz der Gesellschaft: Karlsruhe
Handelsregister: Amtsgericht Mannheim ­ HRB 108550
Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck
Geschäftsführer: Jochen Adenau, Hans-Günther Meier


-----Ursprüngliche Nachricht-----
Von: Bruno Dusausoy [mailto:bdusausoy@yp5.be] 
Gesendet: Montag, 18. Oktober 2010 10:19
An: Camel Users ML
Betreff: Programmatically creating endpoints

Hi,

I have a small application which uses file and mail components.
I pass some endpoints parameters to the application via the 
command-line arguments that are then parsed (thanks to the excellent 
JCommander lib, BTW).
In order to create the routes (and the endpoints) I must concatenate 
some strings.
Is there another way to create endpoints, like programmatically ?

I've been able to successfully create file endpoints entirely 
programmatically thanks to the FileEndpoint class, but I've not been 
able to see a SmtpEndpoint or something similar.

Is the only way of creating endpoints by going through string 
concatenation ?

Regards.
--
Bruno Dusausoy
YP5 Software

--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

Re: Programmatically creating endpoints

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Bruno,

No sure to have fully understood what's your problem.

Anyway, you can create the route in a RouteBuilder.

public void myRouteBuilder(String endpoint1Name, String arg1, String 
value1) {
	RouteBuilder builder = new RouteBuilder() {
	  public void configure() {
		from("seda:" + endpoint1Name + "?" + arg1 + "=" + value1);
	  }
	}
}

Regards
JB

On 10/18/2010 10:19 AM, Bruno Dusausoy wrote:
> Hi,
>
> I have a small application which uses file and mail components.
> I pass some endpoints parameters to the application via the command-line
> arguments that are then parsed (thanks to the excellent JCommander lib,
> BTW).
> In order to create the routes (and the endpoints) I must concatenate
> some strings.
> Is there another way to create endpoints, like programmatically ?
>
> I've been able to successfully create file endpoints entirely
> programmatically thanks to the FileEndpoint class, but I've not been
> able to see a SmtpEndpoint or something similar.
>
> Is the only way of creating endpoints by going through string
> concatenation ?
>
> Regards.
> --
> Bruno Dusausoy
> YP5 Software
>
> --
> Pensez environnement : limitez l'impression de ce mail.
> Please don't print this e-mail unless you really need to.