未找到 FHIR HTTP 404 中的订阅 rest-hook
Subscription rest-hook in FHIR HTTP 404 Not Found
我使用 jersey 在 java 中创建了一个简单的 Rest Endpoint,如下所示:
@Path("/study")
public class CreateRestEndpoint {
private static String endpoint;
@PUT
@Consumes("application/fhir+json")
@Produces(MediaType.APPLICATION_JSON)
public Response getPut(IBaseResource list){
System.out.println("UpdatedResource.: "+list);
return Response.status(200).build();
}
@PUT
public Response getTest(String str) {
System.out.printf(str);
return Response.status(200).build();
}
当我使用 postman 并向 jersey-servlet 发送 PUT 请求时,一切正常,jersey-servlet 立即收到消息。
但是我创建了 jersey-servlet 以获取由 FHIR 服务器(我的 FHIR 服务器在 docker 中的 运行)通过订阅资源发送的消息。实际上,我正在尝试使用订阅机制在列表资源更新时得到通知。:
{
"resourceType": "Subscription",
"id": "9",
"meta": {
"versionId": "2",
"lastUpdated": "2019-11-08T09:05:33.366+00:00",
"tag": [
{
"system": "http://hapifhir.io/fhir/StructureDefinition/subscription-matching-strategy",
"code": "IN_MEMORY",
"display": "In-memory"
}
]
},
"status": "active",
"reason": "Monitor Screening List",
"criteria": "List?code=http://miracum.org/fhir/CodeSystem/screening-list|screening-recommendations",
"channel": {
"type": "rest-hook",
"endpoint": "http://localhost:8080/notification/study",
"payload": "application/fhir+json"
}
}
当我更改 FHIR 中的列表资源时,我希望在 jersey-servlet 中收到一条消息,但不幸的是我收到以下错误(当我将端点设置为测试 rest-hook 时 webhook.site示例,我可以从 FHIR 端获取消息):
fhir_1 | 2019-11-08 18:48:40.688 [subscription-delivery-rest-hook-9-13] INFO c.u.f.j.s.m.i.S.SUBS6 [SubscriptionDebugLogInterceptor.java:162] Delivery of resource List/4/_history/17 for subscription Subscription/9 to channel of type RESTHOOK - Failure: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found
fhir_1 | Exception in thread "subscription-delivery-rest-hook-9-13" org.springframework.messaging.MessagingException: Failure handling subscription payload for subscription: Subscription/9; nested exception is ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found, failedMessage=ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryJsonMessage@330c0fdb[myPayload=ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage@38a1c8a2[mySubscription=ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription@1d55d025[myIdElement=Subscription/9,myStatus=ACTIVE,myCriteriaString=List?..........
..................................................
有什么问题?我尝试了很多不同的参数,但没有找到解决方案。
我将@Path 更改为@Path("/study/List/{var}"),但我再次遇到同样的失败。实际上,我的 FHIR 服务器是 docker 中的 运行,问题可能出在 Docker 中。
在 Docker 中设置代理后,一切正常...
结论:我必须将 @path 更改为 @Path("/study/List/{var}") 并在 Docker.
中设置代理
我使用 jersey 在 java 中创建了一个简单的 Rest Endpoint,如下所示:
@Path("/study")
public class CreateRestEndpoint {
private static String endpoint;
@PUT
@Consumes("application/fhir+json")
@Produces(MediaType.APPLICATION_JSON)
public Response getPut(IBaseResource list){
System.out.println("UpdatedResource.: "+list);
return Response.status(200).build();
}
@PUT
public Response getTest(String str) {
System.out.printf(str);
return Response.status(200).build();
}
当我使用 postman 并向 jersey-servlet 发送 PUT 请求时,一切正常,jersey-servlet 立即收到消息。 但是我创建了 jersey-servlet 以获取由 FHIR 服务器(我的 FHIR 服务器在 docker 中的 运行)通过订阅资源发送的消息。实际上,我正在尝试使用订阅机制在列表资源更新时得到通知。:
{
"resourceType": "Subscription",
"id": "9",
"meta": {
"versionId": "2",
"lastUpdated": "2019-11-08T09:05:33.366+00:00",
"tag": [
{
"system": "http://hapifhir.io/fhir/StructureDefinition/subscription-matching-strategy",
"code": "IN_MEMORY",
"display": "In-memory"
}
]
},
"status": "active",
"reason": "Monitor Screening List",
"criteria": "List?code=http://miracum.org/fhir/CodeSystem/screening-list|screening-recommendations",
"channel": {
"type": "rest-hook",
"endpoint": "http://localhost:8080/notification/study",
"payload": "application/fhir+json"
}
}
当我更改 FHIR 中的列表资源时,我希望在 jersey-servlet 中收到一条消息,但不幸的是我收到以下错误(当我将端点设置为测试 rest-hook 时 webhook.site示例,我可以从 FHIR 端获取消息):
fhir_1 | 2019-11-08 18:48:40.688 [subscription-delivery-rest-hook-9-13] INFO c.u.f.j.s.m.i.S.SUBS6 [SubscriptionDebugLogInterceptor.java:162] Delivery of resource List/4/_history/17 for subscription Subscription/9 to channel of type RESTHOOK - Failure: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found fhir_1 | Exception in thread "subscription-delivery-rest-hook-9-13" org.springframework.messaging.MessagingException: Failure handling subscription payload for subscription: Subscription/9; nested exception is ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found, failedMessage=ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryJsonMessage@330c0fdb[myPayload=ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage@38a1c8a2[mySubscription=ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription@1d55d025[myIdElement=Subscription/9,myStatus=ACTIVE,myCriteriaString=List?.......... ..................................................
有什么问题?我尝试了很多不同的参数,但没有找到解决方案。
我将@Path 更改为@Path("/study/List/{var}"),但我再次遇到同样的失败。实际上,我的 FHIR 服务器是 docker 中的 运行,问题可能出在 Docker 中。 在 Docker 中设置代理后,一切正常... 结论:我必须将 @path 更改为 @Path("/study/List/{var}") 并在 Docker.
中设置代理