Grizzly-Protobuf

Grizzly NIO framework filters to process Google's Protocol Buffers serialized messages.

Лицензия

Лицензия

Категории

Категории

Protobuf Данные Data Structures Grizzly Сеть Networking
Группа

Группа

me.cmoz.grizzly
Идентификатор

Идентификатор

grizzly-protobuf
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Grizzly-Protobuf
Grizzly NIO framework filters to process Google's Protocol Buffers serialized messages.
Ссылка на сайт

Ссылка на сайт

http://github.com/novabyte/grizzly-protobuf
Система контроля версий

Система контроля версий

https://github.com/novabyte/grizzly-protobuf

Скачать grizzly-protobuf

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.cmoz.grizzly/grizzly-protobuf/ -->
<dependency>
    <groupId>me.cmoz.grizzly</groupId>
    <artifactId>grizzly-protobuf</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/me.cmoz.grizzly/grizzly-protobuf/
implementation 'me.cmoz.grizzly:grizzly-protobuf:1.0.0'
// https://jarcasting.com/artifacts/me.cmoz.grizzly/grizzly-protobuf/
implementation ("me.cmoz.grizzly:grizzly-protobuf:1.0.0")
'me.cmoz.grizzly:grizzly-protobuf:jar:1.0.0'
<dependency org="me.cmoz.grizzly" name="grizzly-protobuf" rev="1.0.0">
  <artifact name="grizzly-protobuf" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.cmoz.grizzly', module='grizzly-protobuf', version='1.0.0')
)
libraryDependencies += "me.cmoz.grizzly" % "grizzly-protobuf" % "1.0.0"
[me.cmoz.grizzly/grizzly-protobuf "1.0.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.5
org.glassfish.grizzly : grizzly-framework jar 2.3.5
com.google.protobuf : protobuf-java jar 2.5.0

test (3)

Идентификатор библиотеки Тип Версия
org.mockito : mockito-core jar 1.9.5
org.slf4j : slf4j-simple jar 1.7.5
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Grizzly-Protobuf

Grizzly NIO framework filters to encode and decode Google's Protocol Buffers serialized messages.

Grizzly-Protobuf is created and maintained by Chris Molozian (@novabyte).
Code licensed under the Apache License v2.0. Documentation licensed under CC BY 3.0.

Usage

Grizzly-Protobuf is available on Maven Central.

<dependency>
    <groupId>me.cmoz.grizzly</groupId>
    <artifactId>grizzly-protobuf</artifactId>
    <version>1.0.0</version>
</dependency>

If you're not using Maven (or a dependency resolver that's compatible with Maven repositories), you can download the JARs you need for your project from Maven Central.

Filter Types

At the moment there are two filters to choose from:

  1. FixedLengthProtobufFilter, this uses a fixed length header to store the size of the protobuf message being (de)serialized.
  2. Varint32ProtobufFilter, this uses varint32 encoding to store the size of the protobuf message being (de)serialized.

If you're not sure which to use, start with the Varint32ProtobufFilter and move to the fixed length header alternative if necessary.

Example

Both filters need a MessageLite type to use to parse all incoming messages.

The example below demonstrates the Person protocol format from the Protocol Buffers Java Tutorial with the Varint32ProtobufFilter. All messages sent/received by the filter chain will (de)serialize to the Person protocol format:

final MessageLite prototype = Person.newBuilder()
        .setId(1234)
        .setName("John Doe")
        .setEmail("jdoe@example.com")
        .build();

final FilterChainBuilder serverFilterBuilder = FilterChainBuilder.stateless()
        .add(new TransportFilter())
        .add(new Varint32ProtobufFilter(prototype.getDefaultInstanceForType()));

For more detailed examples of how to integrate this filter into your code have a look at the test cases.

Developer Notes

The codebase requires the Gradle build tool at version 1.6+ and the Java compiler at version 1.6.0 or greater.

The main external dependency for the project is Grizzly NIO, at 2.3.5 or greater and Protobuf-Java at 2.5.0 (for improved parsing performance see here) although older versions are also supported.

For a full list of dependencies see the build script. All dependencies are downloaded by Gradle during the build process.

Building the codebase

A list of all possible build targets can be displayed by Gradle with gradle tasks.

In a regular write-compile-test cycle use gradle test.

A list of all project dependencies can be displayed by Gradle with gradle dependencies.

It is recommended to run Gradle with the Build Daemon enabled to improve performance. e.g. gradle --daemon once the daemon is running it can be stopped with gradle --stop.

Contribute

All contributions to the documentation and the codebase are very welcome. Feel free to open issues on the tracker wherever the documentation needs improving.

Also, pull requests are always welcome! :)

Версии библиотеки

Версия
1.0.0