npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

rx-txjs-adapters

v0.0.4

Published

A collection of adapters to use by rx-txjs

Downloads

8

Readme

RX-TXJS Adapters Package

This package include a collection of adapters use by rx-txjs. RX-TXJS is a generic library not bound to a specfic implementation of queue, parsistance and so on. RX-TXJS is a library able to run you business logic as components (a class with "mountpoint") and job. However of a job need to save itself to continue running later on it need some persistance API but RX-TXJS is not force a specific persistance device instead it define an interface and the user needs to provide a class which implement this interface for a specfic persistance device. Some goes for other interface like queue, express, distribute and so on.

However you can implement those interfaces yourself or use on of those implements provide by rx-txjs-adapters.

  • tx-connector-express - enable component to component direct communication using express. You can same mountpoint interface as use locally in the service between services using javascript express package. This package also use when running rx-txjs jobs acros services.
  • tx-connector-rabbitmq - enable component to component direct communication using rabbitmq queue. You can same mountpoint interface as use locally in the service between services using javascript rabbitmq package. This package also use when running rx-txjs jobs acros services.
  • tx-distribute-bull - job is set of components running one after the other. You can turn on the "publish: distribute" flag to run each component in a distribute manner. tx-distribute-bull class enable to run those component by send them first fo Bull queue then pull them by any other (or this) instance listen to that queue and continue to from the some place.
    • tx-record-persis-mongodb - During job execution data pass between components can be record for auditing. This class enable to to store them using mongodb.

EXamples

  • Using TxConnectorExpress

On receiving service

import { TxRoutePoint, TxTask } from 'rx-txjs';
import { TxRoutePointRegistry } from 'rx-txjs';

export class R1Component {
  private routepoint: TxRoutePoint;
  
  constructor() {
    this.routepoint = TxRoutePointRegistry.instance.create('GITHUB::R1')    
    
    // use TxConnectorExpress to listen on localhost:3001/test1
    this.routepoint.listen('localhost:3001', '/test1').subscribe(

      (task: TxTask<any>) => {
        // when a "message" is arraived call this callback 
        logger.info('[subscribe] got data from service: task = ' + JSON.stringify(task.get(), undefined, 2))        

        let host = 'localhost:'+task.head.port
        let path = task.head.path

        console.log(`R1Component:subscribe going to send to ${host} path ${path}`)

        // return reply to the caller
        this.routepoint.next(host, path, new TxTask<any>({from: 'localhost:3001:/test2'}, 'this is the data send from remote server R1 to localhost'))

        // close the listen point
        this.routepoint.close()
      }
    )
  }
}

On the sending service

import { TxTask } from 'rx-txjs';
import { TxConnectorExpress } from "rx-txjs-adapters";

async function main() {
  let express = new TxConnectorExpress();
  
  let service = await express.listen('localhost:3000', '/test');

  service.subscribe(
    (task) => {
      logger.info('[subscribe] got data from express connector: task = ' + JSON.stringify(task, undefined, 2))

      express.close('localhost:3000', '/test')
    });    
          
  express.next('localhost:3000', 'test', new TxTask<any>({from: 'test'}, {data: 'this is the data'}))
}

main();