正如您在下面看到的,我使用球衣在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();
}
[当我使用邮递员并将PUT请求发送到jersey-servlet时,一切正常,并且jersey-servlet立即获得消息。但是我创建了jersey-servlet来获取一条消息,该消息由FHIR服务器(我的FHIR服务器正在docker中运行)通过Subscription资源发送。实际上,我正在尝试使用订阅机制在List资源更新时得到通知。:
{
"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中收到一条消息,但不幸的是,我收到以下错误消息(当我将端点设置为像webhook.site示例这样的测试挂机时,我可以得到来自FHIR端的消息):
fhir_1 | 2019-11-08 18:48:40.688 [subscription-delivery-rest-hook-9-13] INFO cufjsmiSSUBS6 [SubscriptionDebugLogInterceptor.java:162]将资源列表/ 4 / _history / 17传递给订阅Subscription / 9类型RESTHOOK-故障:ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException:未找到HTTP 404fhir_1 |线程“ subscription-delivery-rest-hook-9-13”中的异常org.springframework.messaging.MessagingException:无法处理订阅的订阅有效载荷:Subscription / 9;嵌套的异常是ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException:未找到HTTP 404, 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中设置代理。