Comments (4)
This is a weird one. The field is marked as STRING (and it says in the docs that it "[...] is currently a specialized form of the string type [...]"), reading it produces a byte[]
array but setting it needs a ByteBuffer
. This is inconsistent to say the least...
I'll look into it.
from thrift-clj.
Anything ever come of this? I just ran into the same issue. Essentially, I cannot set anything as a binary field.
namespace java com.example
struct SomeMessage {
1: binary body
}
service SomeService {
1: sendMsg(1:SomeMessage m)
}
(thrift/import
(:types [com.example SomeMessage])
(:clients [com.example SomeService]))
(def msg
(SomeMessage. (ByteBuffer/wrap (.getBytes "the body" "UTF-8"))))
Produces this:
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.nio.ByteBuffer
at com.example.SomeMessage.setFieldValue(SomeMessage.java:135)
at ns_225746209.SomeMessage.to_thrift_STAR_(producer.clj:32)
at thrift_clj.gen.core$__GT_thrift.invoke(core.clj:19)
at ns404766290$sendMsg.invoke(producer.clj:32)
from thrift-clj.
@charlie-harvey There is 3fbcf1e (from #10), introducing handling of binary
fields, with the caveat that there is no longer an automatic conversion to String
for string
fields. I just noticed that this has never been released - sorry for that.
Could you try out the latest SNAPSHOT? I'll then package a full release once I hear back from you.
[thrift-clj "0.3.0-SNAPSHOT"]
from thrift-clj.
Works!!
(with-open [c (thrift/connect! Clt "localhost:7007")]
(Clt/sendAmqpMessage c
(AmqpMessage. (ByteBuffer/wrap (.getBytes "hello foo")))))
struct AmqpMessage {
1: binary body,
}
service AmqpForwardingService {
bool sendAmqpMessage(1:AmqpMessage m)
}
Thanks so much for pushing that out. Huge help.
from thrift-clj.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thrift-clj.