简而言之,我需要一个包含json的gzip文件,与本例非常相似,解压缩它(我知道该怎么做),将每个json对象作为一个字符串并将其推送到AMQ。弹出到web服务。我对一个对象的所有这些都很好,但我将收到一个代表数组的文件。如果这是一个字符串或xml数组,我看到Camel如何处理它,但我没有看到分割json的方法。此外,这将需要流式传输,因为这些文件可能非常大。 编辑以尝试使请求更清晰,并提供示例json。
[
{
"rickenbackerRepair": {
"estimateId": 22788411
},
"repairShop": {
"inspectionSite": {
"inspectionDate": ""
},
"repairFacility": {
"companyIdCode": "",
"companyName": "",
"city": "",
"stateProvince": "",
"zipPostalCode": "",
"country": ""
},
"repairInformation": {
"guitarDateInShop": "",
"guitarTimeInShop": "",
"authorizationMemo": "",
"guitarTargetCompletionDate": "",
"guitarTargetCompletionTime": "",
"guitarCompletionDate": "",
"guitarCompletionTime": ""
},
"locationOfguitar": {
"city": "",
"stateProvince": "",
"zipPostalCode": "",
"country": ""
}
},
"instrumentIdentifier": {
"guitar": {
"claimRelated": {
"primaryPointOfImpact": "",
"secondaryPointOfImpact": ""
},
"identification": {
"databaseguitarCode": "",
"manufacturingStateProvince": "",
"serialNumber": "",
"guitarCondition": "",
"productionDate": "",
"year": "",
"model": "",
"guitarType": "",
"bodyStyle": "",
"trimCode": "",
"trimColor": "",
"optionsList": ""
}
}
},
"lin": [{
"internalControl": {
"lineIndicator": ""
},
"part": {
"description": {
"partType": "",
"descriptionJudgmentFlag": "",
"oemPartNumber": "",
"priceIncludedIndicator": "",
"alternatePartIndicator": "",
"taxableFlag": "",
"databasePartPrice": "",
"actualPartPrice": "",
"priceJudgmentFlag": "",
"certifiedFlag": "",
"quantity": ""
},
"nonOemSupplier": {
"companyIdCode": "",
"nonOemPartNumber": "",
"nonOemSupplierUserOverride": "",
"nonOemSupplierMemo": ""
},
"adjustment": {
"percent": "",
"amount": ""
}
},
"labor": {
"description": {
"type": "",
"actualHours": "",
"hoursJudgmentFlag": "",
"typeJudgmentFlag": ""
},
"miscSublet": {
"amount": "",
"subletFlag": ""
}
}
}],
"stl": {
"subtotal": [{
"totalType": "",
"totalTypeCode": "",
"subtotalDetail": {
"taxableAmount": ""
}
}]
}
},
{
"rickenbackerRepair": {
"estimateId": 22788412
},
"repairShop": {
"inspectionSite": {
"inspectionDate": ""
},
"repairFacility": {
"companyIdCode": "",
"companyName": "",
"city": "",
"stateProvince": "",
"zipPostalCode": "",
"country": ""
},
"repairInformation": {
"guitarDateInShop": "",
"guitarTimeInShop": "",
"authorizationMemo": "",
"guitarTargetCompletionDate": "",
"guitarTargetCompletionTime": "",
"guitarCompletionDate": "",
"guitarCompletionTime": ""
},
"locationOfguitar": {
"city": "",
"stateProvince": "",
"zipPostalCode": "",
"country": ""
}
},
"instrumentIdentifier": {
"guitar": {
"claimRelated": {
"primaryPointOfImpact": "",
"secondaryPointOfImpact": ""
},
"identification": {
"databaseguitarCode": "",
"manufacturingStateProvince": "",
"serialNumber": "",
"guitarCondition": "",
"productionDate": "",
"year": "",
"model": "",
"guitarType": "",
"bodyStyle": "",
"trimCode": "",
"trimColor": "",
"optionsList": ""
}
}
},
"lin": [{
"internalControl": {
"lineIndicator": ""
},
"part": {
"description": {
"partType": "",
"descriptionJudgmentFlag": "",
"oemPartNumber": "",
"priceIncludedIndicator": "",
"alternatePartIndicator": "",
"taxableFlag": "",
"databasePartPrice": "",
"actualPartPrice": "",
"priceJudgmentFlag": "",
"certifiedFlag": "",
"quantity": ""
},
"nonOemSupplier": {
"companyIdCode": "",
"nonOemPartNumber": "",
"nonOemSupplierUserOverride": "",
"nonOemSupplierMemo": ""
},
"adjustment": {
"percent": "",
"amount": ""
}
},
"labor": {
"description": {
"type": "",
"actualHours": "",
"hoursJudgmentFlag": "",
"typeJudgmentFlag": ""
},
"miscSublet": {
"amount": "",
"subletFlag": ""
}
}
}],
"stl": {
"subtotal": [{
"totalType": "",
"totalTypeCode": "",
"subtotalDetail": {
"taxableAmount": ""
}
}]
}
}
]
答案 0 :(得分:1)
您应该能够使用jsonpath
表达式来分割传入的消息(文件)并单独处理每个元素。
<route>
<from uri="file://path" />
<split>
<jsonpath>$.</jsonpath>
<to uri="direct:doSomething">
</split>
</route>