Skip to main content

Setup a simple orpc server to export services from a jar file.

Project description

jarexps

Setup a simple Open RPC server to export services from a jar file.

Install

pip install jarexps

Usage

Example config.yml

daemon: true
loglevel: INFO

server:
  listen: 0.0.0.0
  port: 1813

authentication:
  enable: true
  users:
    app01: sNKBMFEol0w8CWUCkgxpxlhzbHeHx264

jarexps:
  classpaths:
    - abs/path/to/bcprov-jdk15on-1.70.jar
  services:
    misc.base64.encode:
      klass: org.bouncycastle.util.encoders.Base64
      method: encode
    misc.base64.decode:
      klass: org.bouncycastle.util.encoders.Base64
      method: decode

orpc:
  handler:
    asio-writer-buffer-size: 4096

start server command

jarexpsd -c config.yml start

client tests

import os
import unittest
from orpc.client import OrpcClientPool


class TestJarexps(unittest.TestCase):
    def setUp(self):
        self.cp = OrpcClientPool(
            10,
            kwargs={
                "host": "localhost",
                "port": 1813,
                "username": "app01",
                "password": "sNKBMFEol0w8CWUCkgxpxlhzbHeHx264",
            },
        )

    def test1(self):
        data1 = b"hello world"
        data2 = self.cp.execute("misc.base64.encode", args=[data1])
        assert data2 == b"aGVsbG8gd29ybGQ="

    def test2(self):
        data1 = os.urandom(1024)
        data2 = self.cp.execute("misc.base64.encode", args=[data1])
        data3 = self.cp.execute("misc.base64.decode", args=[data2])
        assert data1 == data3

Releases

v0.1.25

  • First release.

v0.1.26

  • Doc update.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jarexps-0.1.26.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

jarexps-0.1.26-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file jarexps-0.1.26.tar.gz.

File metadata

  • Download URL: jarexps-0.1.26.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for jarexps-0.1.26.tar.gz
Algorithm Hash digest
SHA256 f859bfce867e9c45e5a85343c8f5cf551c1e0724f67b31653b3cba3ada3d6ecc
MD5 7c35aacd9658116ef341f4ef54789e9e
BLAKE2b-256 fa1227149882b3c682a8319fd18203a747759ea505394cebbcf56de029745ca8

See more details on using hashes here.

File details

Details for the file jarexps-0.1.26-py3-none-any.whl.

File metadata

  • Download URL: jarexps-0.1.26-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for jarexps-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 c216cca916e723ed211012f51f9e926cee2fc6b389aad4119e50ae1fac002fa6
MD5 cec6acca3cc043eb3bfa79b0a296e6df
BLAKE2b-256 c11009bd1f759691c51b38d2a20e45e729d7c7a5fa44aaac32211abb310ed263

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page