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.

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.25.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

jarexps-0.1.25-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jarexps-0.1.25.tar.gz
Algorithm Hash digest
SHA256 069e53fb785583bd3883dbd749454dd4c0d5d60004ec217e9dab1fe4b089f13c
MD5 2f9eabfcf969b62c8ab4e3b7292fecdf
BLAKE2b-256 1812a1042a68bf96e92c826ddd7cc1047fe857304db33e8420f679009a9153e0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jarexps-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 f7e92cb370930b788e455cbc859d22386e84837f67eb151fc9db49a20672b3fe
MD5 4c5354318dd04bce9595100400e51c19
BLAKE2b-256 01aa3d57fd8708ee6695acad85fcc9ff4a30ed1a0ad899ac17347e6d549c88a3

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