<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-netty4-http</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-netty4-http</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
Copy to ClipboardCopied!Toggle word wrapToggle overflow
// Upload a large data stream to the server
from("direct:upstream-call")
.bean(Helper.class, "prepareStream")
.to("netty-http:http://localhost:{{port}}/upstream?disableStreamCache=true")
.log("get ${body}");
// Read a large data stream from the client
from("netty-http:http://0.0.0.0:{{port}}/upstream?disableStreamCache=true")
.bean(Helper.class, "processStream")
.to("mock:stream-size");
// Upload a large data stream to the server
from("direct:upstream-call")
.bean(Helper.class, "prepareStream")
.to("netty-http:http://localhost:{{port}}/upstream?disableStreamCache=true")
.log("get ${body}");
// Read a large data stream from the client
from("netty-http:http://0.0.0.0:{{port}}/upstream?disableStreamCache=true")
.bean(Helper.class, "processStream")
.to("mock:stream-size");
Copy to ClipboardCopied!Toggle word wrapToggle overflow
示例 2:从服务器下载大型数据流
// Download a large data stream from the server
from("direct:download-call")
.to("netty-http:http://localhost:{{port}}/downstream?disableStreamCache=true")
.bean(Helper.class, "asyncProcessStream")
.log("get ${body}");
// Write a large data stream to the client
from("netty-http:http://0.0.0.0:{{port}}/downstream?disableStreamCache=true")
.bean(Helper.class, "prepareStream");
// Download a large data stream from the server
from("direct:download-call")
.to("netty-http:http://localhost:{{port}}/downstream?disableStreamCache=true")
.bean(Helper.class, "asyncProcessStream")
.log("get ${body}");
// Write a large data stream to the client
from("netty-http:http://0.0.0.0:{{port}}/downstream?disableStreamCache=true")
.bean(Helper.class, "prepareStream");
Copy to ClipboardCopied!Toggle word wrapToggle overflow