Friday, July 15, 2011

OSB and the Test Message Pattern

I want to be able to treat differently "test" messages from "normal" messages, so as to be able to monitor my application without disrupting the normal business.

Headers are very good at this.

In my test Java client:

HttpPost httppost = new HttpPost(FACADE_URL);
httppost.addHeader("ORIGIN", "TEST");

In my Facade Proxy Service, enable "get all headers".


log $inbound:


  
    
      
        
        Keep-Alive
        102
        text/plain; charset=ISO-8859-1
        acme.com:7009
        Apache-HttpClient/4.1.1 (java 1.5)
      
    
  
  
    
      <anonymous>
    
  
>



The problem is how to propagate the headers to other Proxies (http or local).

Use "Set Transport Headers for outbound Destination" with the option "Pass all Headers through Pipeline" to copy the headers to the destination.
When you route to a LOCAL Proxy Service, the header changes slightly, it uses xsi:type="loc:LocalRequestHeaders" instead of xsi:type="http:HttpRequestHeaders" :


        
        
      


You can extract the header with

$inbound1//tran:user-header[@name="ORIGIN"]


see here for a discussion on the topic, and here for OSB documentation.

No comments: