akka

Fast xml data binding library

License

License

Categories

Categories

Akka Container Microservices Reactive libraries
GroupId

GroupId

ru.tinkoff
ArtifactId

ArtifactId

phobos-akka_2.12
Last Version

Last Version

0.5.1
Release Date

Release Date

Type

Type

jar
Description

Description

akka
Fast xml data binding library
Project URL

Project URL

https://github.com/TinkoffCreditSystems/phobos
Project Organization

Project Organization

ru.tinkoff
Source Code Management

Source Code Management

https://github.com/TinkoffCreditSystems/phobos

Download phobos-akka_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/ru.tinkoff/phobos-akka_2.12/ -->
<dependency>
    <groupId>ru.tinkoff</groupId>
    <artifactId>phobos-akka_2.12</artifactId>
    <version>0.5.1</version>
</dependency>
// https://jarcasting.com/artifacts/ru.tinkoff/phobos-akka_2.12/
implementation 'ru.tinkoff:phobos-akka_2.12:0.5.1'
// https://jarcasting.com/artifacts/ru.tinkoff/phobos-akka_2.12/
implementation ("ru.tinkoff:phobos-akka_2.12:0.5.1")
'ru.tinkoff:phobos-akka_2.12:jar:0.5.1'
<dependency org="ru.tinkoff" name="phobos-akka_2.12" rev="0.5.1">
  <artifact name="phobos-akka_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='ru.tinkoff', module='phobos-akka_2.12', version='0.5.1')
)
libraryDependencies += "ru.tinkoff" % "phobos-akka_2.12" % "0.5.1"
[ru.tinkoff/phobos-akka_2.12 "0.5.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
ru.tinkoff : phobos-core_2.12 jar 0.5.1
org.typelevel : cats-core_2.12 jar 2.1.1
com.fasterxml : aalto-xml jar 1.2.2
org.scala-lang : scala-reflect jar 2.12.10
com.typesafe.akka : akka-http_2.12 jar 10.1.11

provided (1)

Group / Artifact Type Version
com.typesafe.akka : akka-stream_2.12 jar 2.6.4

test (2)

Group / Artifact Type Version
org.scalactic : scalactic_2.12 jar 3.1.1
org.scalatest : scalatest_2.12 jar 3.1.1

Project Modules

There are no modules declared in this project.

phobos

Maven Central Build Scala Steward Discord

Phobos is an XML data-binding library based on stream parsing. It depends on cats-core and aalto-xml for parsing.

Scala 2.12 and 2.13 are supported. Support for Scala 2.11 may be implemented on demand.

QuickStart

Add phobos-core to your dependencies:

libraryDependencies += "ru.tinkoff" %% "phobos-core" % "0.10.1"

Then try this code out in sbt console or in a separate source file:

import ru.tinkoff.phobos.decoding._
import ru.tinkoff.phobos.encoding._
import ru.tinkoff.phobos.syntax._
import ru.tinkoff.phobos.derivation.semiauto._

case class TravelPoint(country: String, city: String)
object TravelPoint {
  implicit val travelPointElementEncoder: ElementEncoder[TravelPoint] = deriveElementEncoder
  implicit val travelPointElementDecoder: ElementDecoder[TravelPoint] = deriveElementDecoder
}

case class Price(@attr currency: String, @text value: Double)
object Price {
  implicit val priceElementEncoder: ElementEncoder[Price] = deriveElementEncoder
  implicit val priceElementDecoder: ElementDecoder[Price] = deriveElementDecoder
}

case class Journey(price: Price, departure: TravelPoint, arrival: TravelPoint)
object Journey {
  implicit val journeyXmlEncoder: XmlEncoder[Journey] = deriveXmlEncoder("journey")
  implicit val journeyXmlDecoder: XmlDecoder[Journey] = deriveXmlDecoder("journey")
}


val journey =
  Journey(
    price = Price("EUR", 1000.0),
    departure = TravelPoint("France", "Marcelle"),
    arrival = TravelPoint("Germany", "Munich")
  )

val xml: String = XmlEncoder[Journey].encode(journey)
println(xml)

val decodedJourney = XmlDecoder[Journey].decode(xml)
println(decodedJourney)

assert(Right(journey) == decodedJourney)

Please see phobos wiki for explanation of the syntax and more details.

Performance

Performance details can be found out in phobos-benchmark repository.

Addons

There are several additional modules for some specific cases. These modules could be added with command below:

libraryDependencies += "ru.tinkoff" %% "phobos-<module>" % "0.10.1

Where <module> is module name.

Module name Functionality
akka-http Marshallers and unmarshallers for akka-http
akka-stream Streaming decoding support for akka-stream
derevo Separate derivation of encoders and decoders separately using derevo annotations (e.g. @derive(xmlEncoder("foo")))
enumeratum Support for enumeratum enums
fs2 Streaming decoding support (Stream[F, Array[Byte]] => G[A])
monix Streaming decoding support (Observable[Array[Byte]] => Task[A])
refined Support for refined

XSD and WSDL code-generation support

It will be soon implemented in deimos library.

ru.tinkoff

Tinkoff.ru

Online financial ecosystem

Versions

Version
0.5.1
0.5.0
0.4.0
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.3
0.1.2
0.1.1