与WSO2 ESB聚集介质的相关表达

时间:2018-05-25 11:48:47

标签: wso2esb

我有两个回复如下:

回应1:

{

    "hotelSet":[
        {
            "hotelname":"hotel1",
            "hotelcode":"A-1000",
            "id":"1000"
        },
        {
            "hotelname":"hotel2",
            "hotelcode":"A-1002",
            "id":"1001"
        }
    ]

}

回应2:

{

    "hotelSet":[
        {
            "hotelname":"hotel1",
            "hotelcode":"B-1000",
            "id":"1000"
        },
        {
            "hotelname":"hotel2",
            "hotelcode":"B-1005",
            "id":"1005"
        }
    ]

}

我想通过检查id是否相同来将这两个响应聚合到响应中。

汇总回复:

{

    "hotelSets":[
        {
            "id":"1000",
            "hotels":[
                {
                    "hotelname":"hotel1",
                    "hotelcode":"A-1000",
                    "set":"A"
                },
                {
                    "hotelname":"hotel1",
                    "hotelcode":"B-1000",
                    "set":"B"
                }
            ]
        },
        {
            "id":"1001",
            "hotels":[
                {
                    "hotelname":"hotel2",
                    "hotelcode":"A-1002",
                    "set":"A"
                }
            ]
        },
        {
            "id":"1005",
            "hotels":[
                {
                    "hotelname":"hotel2",
                    "hotelcode":"B-1005",
                    "set":"B"
                }
            ]
        }
    ]

}

如何查看回复的hotelSet/id?在这种情况下如何使用相关表达式?或者还有其他方式吗?

0 个答案:

没有答案