camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mick Knutson" <mknut...@baselogic.com>
Subject Re: setting dead Letter header in catch block?
Date Mon, 29 Sep 2008 16:02:46 GMT
1. the api *"resultErrorEndpoint.exepectedMessagedReceived(1);"* did not
exist, but "*resultErrorEndpoint.expectedMessageCount(1);"* was there. I was
already using that and here is my entire test:

    public void testCreateInvalidChangeRequest(String inputDestinationURI,
                                               String messageInputBody,
                                               String messageOutputBody
    )
            throws Exception {

        // setup RouteBuilder...
        setRoutes(inputDestinationURI, changeRequestControllerImpl);

        resultEndpoint.expectedMessageCount(0);
     *   resultErrorEndpoint.expectedMessageCount(1);* // is always zero

        // Create and Send message to input queue
        createMessage(producerTemplate, messageInputBody);

        resultErrorEndpoint.expectedMessageCount(1);

resultErrorEndpoint.message(0).header(Constants.EXCEPTION_MESSAGE).isNotNull();


        MockEndpoint.assertIsSatisfied(resultEndpoint, resultErrorEndpoint);
    }


Here is the 1st error caused from *resultEndpoint*:

     <message>
              <![CDATA[mock:*outputDestinationURI *Received message count.
Expected: <0> but was: <1>]]>
            </message>

Then I comment out the *resultEndpoint *check. And get this error from *
resultErrorEndpoint*:

<message>
              <![CDATA[mock:*outputErrorDestinationURI *Received message
count. Expected: <1> but was: <0>]]>
            </message>



On Fri, Sep 26, 2008 at 11:25 PM, Claus Ibsen <ci@silverbullet.dk> wrote:

> Hi
>
> Could you try adding:
> resultErrorEndpoint.exepectedMessagedReceived(1);
>
> before this line:
>
> resultErrorEndpoint.message(0).header(Constants.EXCEPTION_MESSAGE).isNotNull();
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 27. september 2008 01:45
> To: Active MQ; Camel
> Subject: Re: setting dead Letter header in catch block?
>
> I have also tried:
>
>        } catch (Exception e) {
>
> log.error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
>            exchange.getOut().setHeader(Constants.EXCEPTION_MESSAGE,
> e.getMessage() + ".....");
>            throw new RuntimeException(e);
>        }
>
>
> But this does not work as my Mock still does not get the error:
>
>
>
> resultErrorEndpoint.message(0).header(Constants.EXCEPTION_MESSAGE).isNotNull();
>
>
> This is always null. Can someone help?
>
>
>
> On Thu, Sep 25, 2008 at 5:18 PM, Mick Knutson <mknutson@baselogic.com
> >wrote:
>
> > I have the following block that fails:
> >
> >         } catch (Exception e) {
> >
> > log.error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
> > *// i want to set deadLetter headers here ******
> >             throw new RuntimeException(e);
> >         }
> >
> >
> > How can I set my dead letter headers as to the error that occurred? Or is
> > there a better way?
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
> >
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message