camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: extended Camel Mail Component not working
Date Thu, 15 Apr 2010 06:08:08 GMT
On Wed, Apr 14, 2010 at 11:12 AM, Willem Jiang <willem.jiang@gmail.com> wrote:
> Ah, bad mock-javamail, it's good that you finally find out the issue.
> I think we need to update the wiki page of camel-mail to avoid wasting other
> user time to trace this kind of error.
>

I have added a info to the camel mail wiki page


> Willem
>
> Srini97 wrote:
>>
>> Hi,
>>
>> I Identified the problem.  the culprit is mock-javamail which I am using
>> it
>> for testing purpose. so I have removed it and it works fine.
>> Thanks
>> Sri
>>
>>
>>
>>
>> Srini97 wrote:
>>>
>>> no luck :( , I went and saw the sender code on the producer
>>>
>>> sender.send(new MimeMessagePreparator() {
>>>            public void prepare(MimeMessage mimeMessage) throws Exception
>>> {
>>>                endpoint.getBinding().populateMailMessage(endpoint,
>>> mimeMessage, exchange);
>>>                              System.out.println("endpoint.content
type
>>> resolver--->"+endpoint.getContentTypeResolver());
>>>                System.out.println("Content
>>> Type--->"+mimeMessage.getContentType());
>>>                System.out.println("Sending
>>> message"+MailUtils.dumpMessage(mimeMessage));
>>>                                if (LOG.isDebugEnabled()) {
>>>                    LOG.debug("Sending MimeMessage: " +
>>> MailUtils.dumpMessage(mimeMessage));
>>>                }
>>>            }
>>>        });
>>>
>>> I am able to get all the information what I am providing , mail is not
>>> delivered to the receipient.
>>>
>>> Sri
>>>
>>>
>>>
>>> willem.jiang wrote:
>>>>
>>>> Did you extend the camel mail component? if so, please add some break
>>>> point in the MailProducer, and debug to see if the sender is called send
the
>>>> mail.
>>>>
>>>> Willem
>>>>
>>>> Srini97 wrote:
>>>>>
>>>>> I have added three options in the configuration and when I tried with
>>>>> Unit
>>>>> testcases it is working properly when I put some debug messages I can
>>>>> all the messages but the message is
>>>>> not
>>>>> delivered to mail that mentioned in the URI.
>>>>>
>>>>> By the way I have changed the URI to my custom URI to identify my
>>>>> component
>>>>> by autodiscovery so say for smtp , my own uri is
>>>>> opta-smtp://xxxx@host?xbody=sadfsdf,
>>>>>
>>>>> I have created opta-smtp file under
>>>>>
>>>>> /src/main/resources/META-INF/services/org/apache/camel/component/opta-smtp
>>>>>
>>>>> done the same for  all the protocols.
>>>>>
>>>>>
>>>>> Thanks
>>>>> Sri
>>>>>
>>>>>
>>>>> willem.jiang wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> What kind of default nature of camel component is changed in your
>>>>>> component?
>>>>>>
>>>>>> Can you step into producer.process(exchange) to see what is happened
?
>>>>>>
>>>>>>
>>>>>> Willem
>>>>>>
>>>>>> Srini97 wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I have a requirement for adding new options for the message ,
so I
>>>>>>> have
>>>>>>> created new options like x_body , x_createAttachement , Based
on
>>>>>>> these
>>>>>>> two
>>>>>>> options I have to over ride the default nature of camel component.
So
>>>>>>> I
>>>>>>> have
>>>>>>> extended MailBinding and over ridden some methods. and written
test
>>>>>>> cases
>>>>>>> for that . test cases are working fine. But when I tried to send
the
>>>>>>> messages  using the following code it is not sending any messages
but
>>>>>>> calling producer send() method.
>>>>>>>
>>>>>>>
>>>>>>>        CamelContext context=new DefaultCamelContext();
>>>>>>>
>>>>>>>        OptaMailComponent component=new OptaMailComponent(context);
>>>>>>>
>>>>>>>        OptaMailEndpoint endpoint =
>>>>>>>
>>>>>>> (OptaMailEndpoint)component.createEndpoint("opta-smtp://optaukexch01.optasportsdata.com?To=srinivasa.dontiboyina@optasports.com&from=srinivasa.dontiboyina@optasports.com&consumer.delay=6000&subject=Hurry%20got%20the%20subject");
>>>>>>>
>>>>>>>
>>>>>>>        OptaMailEndpoint endpoint =
>>>>>>>
>>>>>>> (OptaMailEndpoint)component.createEndpoint("opta-smtp://optaukexch01.optasportsdata.com?To=srinivasa.dontiboyina@optasports.com&from=srinivasa.dontiboyina@optasports.com&consumer.delay=6000&subject=samplesubject");
>>>>>>>
>>>>>>>        Exchange exchange = endpoint.createExchange();
>>>>>>>
>>>>>>>        // set the in message payload (=body) with the name
parameter
>>>>>>>            exchange.getIn().setBody("sample body");
>>>>>>>
>>>>>>>
>>>>>>>         // now we want to send the exchange to this endpoint
and we
>>>>>>> then
>>>>>>> need a producer
>>>>>>>         // for this, so we create and start the producer.
>>>>>>>          Producer producer = endpoint.createProducer();
>>>>>>>          producer.start();
>>>>>>>                                    // process
the exchange will send
>>>>>>> the exchange to the file
>>>>>>> component, that will process
>>>>>>>         // the exchange and yes write the payload to the
given
>>>>>>> filename
>>>>>>>         producer.process(exchange);
>>>>>>>
>>>>>>>         // stop the producer, we want to be nice and cleanup
>>>>>>>         producer.stop();
>>>>>>>
>>>>>>>
>>>>>>>   2) Even after creating source as jar and included in other
>>>>>>> component
>>>>>>> where previously it used the default mail component is also not
>>>>>>> sending
>>>>>>> any
>>>>>>> mail message to sender.
>>>>>>>
>>>>>>> Thanks in advance for the help me!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>
>> :jumping::jumping::jumping::jumping::jumping::jumping::jumping::jumping::jumping::handshake::handshake::handshake::jumping::jumping::jumping:
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message