Question: How can I convert `<int-jms:outbound-channel-adapter channel="topicChannel" destination="requestQueue"/>` to equivalent [Spring Integration DSL](https://github.com/spring-projects/spring-integration-java-dsl/wiki/spring-integration-java-dsl-reference) in java 1.7 

Below is the ActiveMQ configuration:

```
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory">
        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://localhost:61616"/>
        </bean>
    </property>
    <property name="sessionCacheSize" value="10"/>
</bean>

<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="queue.demo"/>
</bean>

```

Answer: 
You are on the right path - reduce is one way to do it (you'll also need `Object.keys` to loop through each object's properties

Comments inline - note that this does a (simple) isNumber check before counting / adding

```
var data = [{"taxAmount":572.26,"totalAmount":2004,"totalDiscount":0,"totalItems":12,"gTotal":2576.2599999999998,"count":4,"deployment":{"_id":"554c92f979d26026307a5a9b","name":"Punjabi Bagh"}},
{"taxAmount":304.9,"totalAmount":1111,"totalDiscount":0,"totalItems":9,"gTotal":1415.8999999999999,"count":2,"deployment":{_id:"554c930579d26026307a5a9c","name":"Pitampura"}},
{"deployment":{"_id":"554c930c79d26026307a5a9d","name":"Model Town"}},   
{"deployment":{"_id":"554c945079d26026307a5cae","name":"Dwarka"}},
{ "deployment": { "_id": "554cd66c0a40ccd2416e38e7", "name": "Green Park" } }]

var result = data.reduce(function (a, b) {
    // loop through the properties
    Object.keys(b).forEach(function (key) {
        // check if it's a number
        if (!isNaN(parseFloat(b[key]))) {
            // get the running count / sum for this key or initialize a new one
            a[key] = a[key] || { sum: 0, count: 0 }
            a[key].sum += Number(b[key]);
            a[key].count++;
        }
    })

    return a;
}, {})

console.log(result)

```
Assuming your data is contained in an array called `values`:

```
var taxAmount = 0,
    totalAmount = 0,
    objectsWithTotalAmount = 0;
for (int i = 0; i < values.length; i++) {
    if (values[i].hasOwnProperty("taxAmount") {
        taxAmount += values[i].taxAmount;
    }
    if (values[i].hasOwnProperty("totalAmount") {
        totalAmount += values[i].totalAmount;
        objectsWithTotalAmount++;
    }
}

```

With `.hasOwnProperty()` you check whether the object contains that property. That way you have your sums at `taxAmount` and `totalAmount`, as well as the number of objects that have the `totalAmount` property.