Giter Site home page Giter Site logo

remotepoi's Introduction

RemotePOI

RemotePOI is a gRPC service that provides for the manipulation of xls/xlsx files using NPOI.

日本語版

Quick start

Starting the Service.

You can use a Docker container to start a service.

cd /path/to/this/repository
docker build -t rpoi_svc ./XlsManiSvc/
docker run -ti -p 37722:80 -v ${PWD}/sample_template:/mnt rpoi_svc

The container is now up and the gRPC service is waiting on port number 37722. We are hosting it using the ASP.NET Core gRPC service.

Running the Sample Client.

The ruby_client/ directory contains sample code for a client written in Ruby.

The sample is to open a file sample_template/est_template.xls, set values in some cells and save them, and so on. You can do this in the following way (Replace 192.168.1.158 with host's address of the service is running).

gem install grpc grpc-tools
cd ruby_client/
ruby ./rpoi_client.rb '192.168.1.158:37722' /tmp/sample.xls

Now the file should be saved to /tmp/sample.xls.

Multi-session mode.

Multi-session mode is enabled by setting the environment variable ENABLE_MULTI_SESSION when the service is started. When not in multi-session mode, the service will not be able to distinguish between multiple sessions when a user tries to access the service from a single source. You should always use multi-session mode if you expect parallel access to the service.

On the client side, the service gives you an HTTP header x-session-id when you access the service for the first time, so you need to add it to your request on the second and subsequent accesses.

The above sample is in ruby_client/rpoi_client2.rb, and you can find it in The following is an example. It is designed to open two sessions simultaneously from the same access source (IP address and port number) to perform file operations in parallel.

You can do this as follows:

Starting the service

docker build -t rpoi_svc ./XlsManiSvc/
docker run -ti -p 37722:80 -v ${PWD}/sample_template:/mnt -e ENABLE_MULTI_SESSION=1 rpoi_svc

Run the sample client

ruby ./rpoi_client2.rb '192.168.1.158:37722' /tmp/sample.xls

How to regenerate the gRPC definition

NET, it is automatically regenerated at build time.

For Ruby clients, you can regenerate it with the following commands

grpc_tools_ruby_protoc -I../XlsManiSvc/XlsManiSvc/Protos --ruby_out=lib --grpc_out=lib ../XlsManiSvc/XlsManiSvc/Protos/rpoi.proto

Appendix.

Useful links on handling HTTP headers in gRPC.

remotepoi's People

Contributors

lobin-z0x50 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.