thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Pocreau <tho...@colisweb.com>
Subject Using ThriftStructCodec from Scrooge with Thrift
Date Tue, 05 May 2015 17:57:52 GMT
Hi,

I'm new to thrift.
I'm trying to use Thrift (without rpc) and Scrooge with Scala, Akka and
Kafka.

I feels like I'm not using the full framework but I can't find the entry
point.

For now I'm using encoder and decode methods right from ThriftStructCodec3
Encoding :

val cost = Cost("defaultCost", 1)
val protocol = new TCompactProtocol.Factory
val transport = new TMemoryBuffer(100)
CostThrift.encoder(cost, protocol.getProtocol(transport))
producer.send(new KeyedMessage(topic, transport.getArray, transport.getArray))

decoding :

val protocolFactory = new TCompactProtocol.Factory

case message: Array[Byte] => {
  val transport = new TIOStreamTransport(new ByteArrayInputStream(message))
  val protocol = protocolFactory.getProtocol(transport)
  val cost: CostThrift = CostThrift.decode(protocol)

The first limitation is that I have multiple ThriftStruct and I don't now
which ThriftStructCodec3 I should use to decode the message.
I could really use some guidance On how to fit the code generated by
scrooge inside the thrift framework.

Thanks a lot.

-- 
*Thomas Pocreau*
Recherche & Développement | *Colisweb*

thomas@colisweb.com
06 45 12 61 58
Euratechnologies | 165, Avenue de Bretagne
59000 - Lille

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message