Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Tuesday, February 23, 2016

How to get response back immediately after WSO2 ESB Proxy Service get the message?

   
I send a message to ESB proxy service, and I would like to get response immediately after the service receive the content and put into the message queue. That means the proxy service will send back response message before it gets processed.

WSO2 ESB provides properties as a way to control different aspects of the messages flowing through the mediation engine. They will not change the content (payload) of the message but they will be used to change the behavior of the message flowing through the ESB.

FORCE_SC_ACCEPTED is the property we could use for this purpose.

FORCE_SC_ACCEPTED

When set to true, this property forces a 202 HTTP response to the client so that it stops waiting for a response.
( 202 HTTP is for the request has been accepted for processing, but the processing has not been completed. )

We can set this property as below.

<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>

This property can be used in scenarios where client send a message to the ESB and ESB will store the message in a persistent store like a message store. In this scenario, client will wait until the timeout if ESB do not send any response. In this kind of scenario, we can use this property and send a 202 Accepted response to the client. Here is an example configuration where ESB store a message in a message store.

  <inSequence>  
    <property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>  
    <store messageStore="POInbound"/>  
   </inSequence>  


Tuesday, March 17, 2015

JPA error: "Null value was assigned to a property of primitive type setter of MyDomain.myAttribute"

I have a database table, one of the columns is REF_ID(INTEGER), and this column can be set as null. When I used Eclipse JPA tool to generate JPA Entities from tables, this attribute was generated as this.

 @Column(name="REF_ID")  
      private int refId;  

When I tested it, and set null value to this attribute, I got the error "Null value was assigned to a property of primitive type setter of MyDomain.myAttribute".

To solve the problem, I just simply changed the int data type to Integer. Then everything works perfectly fine.

A null value cannot be assigned to a primitive type, like int, long, boolean, etc. If the database column that corresponds to the field in your object can be null, then your field should be a wrapper class, like Integer, Long, Boolean, etc.