Credit for #542
This commit is contained in:
parent
8a32e4bae5
commit
fc7ac7ab00
|
@ -1,5 +1,8 @@
|
||||||
package example;
|
package example;
|
||||||
|
|
||||||
|
import org.hl7.fhir.dstu3.model.Bundle;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.okhttp.client.OkHttpRestfulClientFactory;
|
import ca.uhn.fhir.okhttp.client.OkHttpRestfulClientFactory;
|
||||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||||
|
@ -35,6 +38,26 @@ public class ClientExamples {
|
||||||
// END SNIPPET: proxy
|
// END SNIPPET: proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public void processMessage() {
|
||||||
|
// START SNIPPET: processMessage
|
||||||
|
FhirContext ctx = FhirContext.forDstu3();
|
||||||
|
|
||||||
|
// Create the client
|
||||||
|
IGenericClient client = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
// ..populate the bundle..
|
||||||
|
|
||||||
|
Bundle response = client
|
||||||
|
.operation()
|
||||||
|
.processMessage() // New operation for sending messages
|
||||||
|
.setMessageBundle(bundle)
|
||||||
|
.asynchronous(Bundle.class)
|
||||||
|
.execute();
|
||||||
|
// END SNIPPET: processMessage
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void createOkHttp() {
|
public void createOkHttp() {
|
||||||
// START SNIPPET: okhttp
|
// START SNIPPET: okhttp
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ca.uhn.fhir.rest.gclient;
|
package ca.uhn.fhir.rest.gclient;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* HAPI FHIR - Core Library
|
* HAPI FHIR - Core Library
|
||||||
|
@ -24,29 +22,27 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
public interface IOperation extends IBaseOn<IOperationUnnamed> {
|
public interface IOperation extends IBaseOn<IOperationUnnamed> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This operation is called <b><a href="https://www.hl7.org/fhir/messaging.html">$process-message</a></b> as defined by FHIR
|
* This operation is called <b><a href="https://www.hl7.org/fhir/messaging.html">$process-message</a></b> as defined by the FHIR
|
||||||
* DSTU2.<br><br>
|
* specification.<br><br>
|
||||||
* Usage :<br>
|
* Usage :<br>
|
||||||
* <code>
|
* <code>
|
||||||
* <pre>
|
* <pre>
|
||||||
* Bundle response = client
|
* Bundle response = client
|
||||||
* .operation()
|
* .operation()
|
||||||
* .onServer()
|
|
||||||
* .processMessage()
|
* .processMessage()
|
||||||
|
* .synchronous(Bundle.class)
|
||||||
* .setResponseUrlParam("http://myserver/fhir")
|
* .setResponseUrlParam("http://myserver/fhir")
|
||||||
* .setMessageBundle(msgBundle)
|
* .setMessageBundle(msgBundle)
|
||||||
* .synchronous(Bundle.class)
|
|
||||||
* .execute();
|
* .execute();
|
||||||
*
|
*
|
||||||
* //if you want to send an async message
|
* //if you want to send an async message
|
||||||
*
|
*
|
||||||
* OperationOutcome response = client
|
* OperationOutcome response = client
|
||||||
* .operation()
|
* .operation()
|
||||||
* .onServer()
|
|
||||||
* .processMessage()
|
* .processMessage()
|
||||||
|
* .asynchronous(OperationOutcome.class)
|
||||||
* .setResponseUrlParam("http://myserver/fhir")
|
* .setResponseUrlParam("http://myserver/fhir")
|
||||||
* .setMessageBundle(msgBundle)
|
* .setMessageBundle(msgBundle)
|
||||||
* .asynchronous(OperationOutcome.class)
|
|
||||||
* .execute();
|
* .execute();
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -306,6 +306,10 @@
|
||||||
<id>sekaijin</id>
|
<id>sekaijin</id>
|
||||||
<name>sekaijin</name>
|
<name>sekaijin</name>
|
||||||
</developer>
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>hugosoares</id>
|
||||||
|
<name>Hugo Soares</name>
|
||||||
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|
|
@ -178,6 +178,10 @@
|
||||||
are now populated into the OperationOutcome produced by
|
are now populated into the OperationOutcome produced by
|
||||||
create and update operations
|
create and update operations
|
||||||
</action>
|
</action>
|
||||||
|
<action type="add">
|
||||||
|
Add support for the $process-message operation to fluent client.
|
||||||
|
Thanks to Hugo Soares for the pull request!
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="2.2" date="2016-12-20">
|
<release version="2.2" date="2016-12-20">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
|
@ -518,6 +518,20 @@
|
||||||
|
|
||||||
|
|
||||||
</subsection>
|
</subsection>
|
||||||
|
|
||||||
|
<subsection name="Built-In Operations - Process-Message">
|
||||||
|
<p>
|
||||||
|
The <code>$process-message</code> operation asks the server to accept a fhir
|
||||||
|
message bundle for processing.
|
||||||
|
</p>
|
||||||
|
<macro name="snippet">
|
||||||
|
<param name="id" value="processMessage" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ClientExamples.java" />
|
||||||
|
</macro>
|
||||||
|
|
||||||
|
|
||||||
|
</subsection>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue