Skip to content

stomp-js/samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stompjs and rx-stomp Samples

These simples demonstrate usage of https://github.com/stomp-js/stompjs family of libraries.

To run these samples you would need a STOMP broker running locally.

These samples should work out of the box with a fresh RabbitMQ installation with plugin rabbitmq_web_stomp enabled.

stompjs

rx-stomp

Remote Procedure Call

These are implemented using rx-stomp and can be used with ng2-stompjs.

Simple RPC

This demonstrates RxStompRPC#rpc.

See the client at:

You will need to run at least one of the following servers:

Considering what it delivers, the code as a whole is quite simple. There are more things to observe:

  • These examples support load balancing - start multiple servers and see that RabbitMQ will load balance across those.
  • If you are using rpc/ruby-server/server-thread-pool.rb you can observe that in case of failures the request is retried.
  • The scheme can be implemented in any language.
  • Load balancing works across different flavors of servers.
  • When you start a client with no active servers, the requests will be queued till a server comes online and processes it. This can be controlled using TTL (time to live) capabilities of RabbitMQ.

If you are planning to use this in production you might consider using rpc/ruby-server/server-thread-pool.rb as your base.

Streaming RPC

This demonstrates RxStompRPC#stream.

It extends the previous example, however allows multiple responses to be sent from the server to the client. This examples uses this capability to communicate progress status.

See the client at:

  • rpc/stream/rx-rpc-with-progress.html.
  • Click the button Submit Problem many times to see each one getting submitted as independent requests.
  • It makes clever use of RxJS operators to keep the code for progress and actual result separate.
  • This closes the observable once final results have arrived.

See the server at:

Ruby servers

  • These use bunny to communicate which uses AMQP.
  • These have been tested with Ruby 2.5.
  • You need to install dependencies by running bundle install in folder rpc/ruby-server.
  • Start the server by running bundle exec ruby <script-name>.

References

About

Samples for stompjs and rx-stomp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published