当我使用 Postman 发帖时,Camel Karavan Apache 中没有错误,但为什么我得到状态 500?并且,API首先通过Kafka走另一条路线。
嗯,我尝试了很多方法让它在发布正文请求时出现在Postman中,但我仍然无法做到这一点。我预计会出现与 Karavan 日志中相同的结果。
Camel Karavan 的 Yaml:
- restConfiguration:
component: platform-http
host: 5.181.132.121
port: "8893"
useXForwardHeaders: false
contextPath: /api/v1
apiContextPath: /api-doc
bindingMode: auto
inlineRoutes: true
- rest:
id: rest-4e3a
description: Insurance Claim Submission
path: /claim-submission
consumes: application/json
produces: application/json
bindingMode: auto
post:
- id: post-6804
to: direct:direct-store-kafka
consumes: application/json
produces: application/json
param:
- description: Claim Type
name: Claim-Type
type: header
dataType: String
- rest:
id: rest-e831
description: Insurance Claim Submission 1
path: /claim-submission-1
consumes: application/json
produces: application/json
get:
- id: get-9e1e
to: direct:test-direct
consumes: application/json
produces: application/json
- route:
id: direct-store-kafka
description: Store to Kafka
from:
id: from-d33b
uri: direct
parameters:
name: direct-store-kafka
steps:
- log:
id: log-59e6
message: ${headers}
logName: beginZaHeaders
- choice:
id: choice-9c6f
when:
- id: when-74fa
expression:
simple:
id: simple-c3c2
expression: ${header.Claim-Type} == 'outpatient'
steps:
- setHeader:
id: setHeader-350b
name: kafka.KEY
expression:
simple:
id: simple-850c
expression: ${uuid}
- log:
id: log-6462
message: ${header.kafka.KEY}
logName: key
- marshal:
id: marshal-d205
json:
id: json-ae81
- log:
id: log-5f65
message: ${body}
- to:
id: to-7424
uri: kafka
parameters:
topic: outpatient
brokers: kafka-0:9092,kafka-1:9092,kafka-2:9092
otherwise:
id: otherwise-93fe
steps:
- log:
id: log-0c46
message: ${body}
- route:
id: route-e9dc
nodePrefixId: route-60b
from:
id: from-7c87
uri: kafka
parameters:
topic: outpatient
brokers: kafka-0:9092,kafka-1:9092,kafka-2:9092
steps:
- log:
id: log-9197
message: ${headers}
logName: afterKafka
- log:
id: log-raw
message: "Raw message: ${body}"
logName: raw
- setProperty:
id: setProperty-8b6c
name: bodyRequest
expression:
simple:
id: simple-5a9b
expression: ${body}
- unmarshal:
id: unmarshal-1181
json:
id: json-1a26
- setProperty:
id: setProperty-ff4c
name: eventCoding
expression:
simple:
id: simple-51be
expression: ${body[entry][0][resource][eventCoding][code]}
- log:
id: log-c44e
message: ${exchangeProperty.eventCoding}
logName: eventCoding
- setProperty:
id: setProperty-56c5
name: destination
expression:
simple:
id: simple-f78b
expression: >-
${body[entry][0][resource][destination][0][receiver][identifier][type][coding][0][code]}
- log:
id: log-7e32
message: ${exchangeProperty.destination}
logName: destination code
- log:
id: log-a01e
message: ${body}
logName: bodyb4request
- log:
id: log-43d6
message: ${headers}
logName: headerDaTo?!
- toD:
id: toD-5fcd
uri: >-
https://veinscdr.mhnexus.com/baseR4/Endpoint?name=veinsBridge&organization=${exchangeProperty.destination}
- log:
id: log-b85f
message: ${body}
logName: bodyafterrequest
- unmarshal:
id: unmarshal-ef6a
json:
id: json-1123
- log:
id: log-9878
message: ${body[entry][0][resource][address]}
logName: endpointRequest
- setBody:
id: setBody-01bb
expression:
simple:
id: simple-6be8
expression: ${exchangeProperty.bodyRequest}
- log:
id: log-5931
message: ${body}
logName: requestBody
- setHeader:
id: setHeader-994c
name: Content-Type
expression:
simple:
id: simple-46da
expression: application/json
- setHeader:
id: setHeader-5a5c
name: CamelHttpMethod
expression:
simple:
id: simple-cc51
expression: POST
- setHeader:
id: setHeader-d934
name: Accept
expression:
simple:
id: simple-f1ff
expression: application/json
- setHeader:
id: setHeader-1cea
name: Accept-Encoding
expression:
simple:
id: simple-4f3c
expression: gzip
- setHeader:
id: setHeader-a462
name: Claim-Type
expression:
simple:
id: simple-8d10
expression: outpatient
- setHeader:
id: setHeader-60e2
name: Postman-Token
expression:
simple:
id: simple-ab50
expression: e3109c8d-6f83-43de-a1d1-6801658f7e7d
- setHeader:
id: setHeader-105f
description: Token
name: Authorization
expression:
simple:
id: simple-0b03
expression: >-
Bearer
hDkixqnIV2YgTeFG1lCBEO6+uAXUvx7bq7wg1FThAyslKtMtOvVScU315rvEblv5XkC9NNHKBhqn8aV/NbWt9qotI3b0Qgc7PVSfDu0Q/YnNk8eL0HX82ES1cN63hAMd
- log:
id: log-38b3
message: ${headers}
logName: headerOn!!
- toD:
id: toD-6b4d
uri: http://5.181.132.121:8890/${exchangeProperty.eventCoding}
- log:
id: log-8d3f
message: ${headers}
logName: headOff!?
- log:
id: log-212c
message: ${body}
logName: medilik-request-log
- setVariable:
id: setVariable-a582
name: global:getBody
expression:
simple:
id: simple-2767
expression: ${body}
- route:
id: route-5e85
nodePrefixId: route-638
from:
id: from-0e13
uri: direct
parameters:
name: test-direct
steps:
- setProperty:
id: setProperty-0a62
name: setBody
expression:
simple:
id: simple-19d2
expression: ${variable:global:getBody}
- setBody:
id: setBody-0fe1
expression:
simple:
id: simple-b31f
expression: ${exchangeProperty.setBody}
- log:
id: log-754a
message: ${headers}
logName: headPush!!!
- log:
id: log-2e89
message: ${body}
logName: logXross
你能更好地解释一下你的期望吗?你使用postman调用camel,你会得到一个http 500错误,并且没有“错误消息”。您想查看某种包含某种 java stracktrace 或其他内容的内部服务错误消息吗?
您在 Camel 日志(即所谓的 karavan 日志)中看到任何此类详细信息吗