【问题标题】:finagle thrift generator for javajava的finagle节俭生成器
【发布时间】:2012-11-25 03:04:19
【问题描述】:

我见过两个工具来生成兼容 finagle 的节俭。

  1. thrift-0.5.0-finagle 是否太旧?最新的是 thrift 0.9。我还能用吗?

  2. 或者我应该使用Scrooge?它在 Scala 上生成一个 Java 绑定。

【问题讨论】:

    标签: java generator thrift finagle


    【解决方案1】:

    如果您的项目是 Scala 或 Java,您应该使用 Scrooge。 thrift-0.5.0-finagle 已被弃用。

    【讨论】:

      【解决方案2】:

      你应该使用 Scrooge。 Scrooge 是由 Twitter 开发的。而且 Finagle 也是由 Twitter 开发的。

      提示:

      scrooge maven插件配置如下

      <plugin>
          <groupId>com.twitter</groupId>
          <artifactId>scrooge-maven-plugin</artifactId>
          <version>${scrooge.version}</version>
          <configuration>
              <thriftSourceRoot>${basedir}/src/main/thrift</thriftSourceRoot>
              <includes>
                  <set>SyncWrite.thrift</set>
              </includes>
              <outputDirectory>${basedir}/src/main/gen/</outputDirectory>
              <thriftNamespaceMappings>
                  <thriftNamespaceMapping>
                      <from>com.ganji.cdc.xapian.thrift.cpp</from>
                      <to>com.ganji.cdc.xapian.thrift.cpp</to>
                  </thriftNamespaceMapping>
              </thriftNamespaceMappings>
              <language>experimental-java</language>
              <thriftOpts>
                  <thriftOpt>--finagle</thriftOpt>
              </thriftOpts>
              <buildExtractedThrift>false</buildExtractedThrift>
          </configuration>
          <executions>
              <execution>
                  <id>thrift-sources</id>
                  <phase>generate-sources</phase>
                  <goals>
                      <goal>compile</goal>
                  </goals>
              </execution>
              <execution>
                  <id>thrift-test-sources</id>
                  <phase>generate-test-sources</phase>
                  <goals>
                      <goal>testCompile</goal>
                  </goals>
              </execution>
          </executions>
      </plugin>
      

      语言是experimental-java。如果配置为 Scrooge 文档,使用javalibthrift 库必须使用0.5.0

      有如下依赖库

      <finagle.version>6.25.0</finagle.version>
      <scrooge.version>3.18.1</scrooge.version>
      
      <!-- Finagle Start -->
      <dependency>
          <groupId>org.apache.thrift</groupId>
          <artifactId>libthrift</artifactId>
          <version>0.9.0</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>scrooge-core_2.10</artifactId>
          <version>${scrooge.version}</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>scrooge-runtime_2.10</artifactId>
          <version>${scrooge.version}</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>util-core_2.10</artifactId>
          <version>6.24.0</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>finagle-core_2.10</artifactId>
          <version>${finagle.version}</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>finagle-thrift_2.10</artifactId>
          <version>${finagle.version}</version>
      </dependency>
      <!-- Finagle End -->
      

      仅此而已。

      【讨论】:

      • 这些版本可以更新吗?我看到一个 github 问题 libthrift 更新到 0.10
      • 几年前我就用过这个库或软件。我刚刚注意到他们将 libthrift 更新为 0.10。
      • 是的,实际上我只是想开始使用它,并且遇到了这些答案,这就是我问的原因
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-28
      • 2012-03-02
      • 2017-08-12
      • 2019-03-31
      相关资源
      最近更新 更多