Git Product home page Git Product logo

ejabberd-mam2sidekiq's Introduction

ejabberd MAM/Sidekiq Bridge

Test

This is a custom ejabberd module which allows to bridge all archived messages (from Message Archive Management/XEP-0313) to actual Sidekiq jobs on a Redis database. This enables third party applications to work and react on messages without implementing a XMPP presence application which must subscribe to all multi user chats. Furthermore this module allows direct messages to be processed the same way as multi user chat messages on third party applications. This module requires an activated ejabberd mod_mam to work, because we listen for the storage hooks. They do not suffer from message dupplication. (Copies, changing sender/receiver side)

Requirements

Runtime

Build and development

Installation

See the detailed installation instructions to get the ejabberd module up and running. When you are using Debian/Ubuntu, you can use an automatic curl pipe script which simplifies the installation process for you.

Configuration

We make use of the global database settings of ejabberd, but you can also specify a different database type by setting it explicitly.

# Global Redis config
# See: https://docs.ejabberd.im/admin/configuration/#redis
redis_server: "redis.server.com"
redis_port: 6379
redis_db: 1

modules:
  mod_mam2sidekiq:
    sidekiq_queue: "default"
    sidekiq_class: "SomeWorker"

Development

Getting started

The project bootstrapping is straightforward. We just assume you took already care of the requirements and you have your favorite terminal emulator pointed on the project directory. Follow the instructions below and then relaxen and watchen das blinkenlichten.

# Installs and starts the ejabberd server and it's database
$ make start

# (The jabber server should already running now on its Docker container)

# Open a new terminal on the project path,
# install the custom module and run the test suite
$ make reload test

When your host mDNS Stack is fine, you can also inspect the ejabberd admin webconsole with [email protected] as username and defaultpw as password. In the case you want to shut this thing down use make stop.

mDNS host configuration

If you running Ubuntu/Debian, all required packages should be in place out of the box. On older versions (Ubuntu < 18.10, Debian < 10) the configuration is also fine out of the box. When you however find yourself unable to resolve the domains or if you are a lucky user of newer Ubuntu/Debian versions, read on.

Heads up: This is the Arch Linux way. (package and service names may differ, config is the same) Install the nss-mdns and avahi packages, enable and start the avahi-daemon.service. Then, edit the file /etc/nsswitch.conf and change the hosts line like this:

hosts: ... mdns4 [NOTFOUND=return] resolve [!UNAVAIL=return] dns ...

Afterwards create (or overwrite) the /etc/mdns.allow file when not yet present with the following content:

.local.
.local

This is the regular way for nss-mdns > 0.10 package versions (the default now). If you use a system with 0.10 or lower take care of using mdns4_minimal instead of mdns4 on the /etc/nsswitch.conf file and skip the creation of the /etc/mdns.allow file.

Further readings

Test suite

The test suite sets up a simple environment with 3 independent users. (admin, alice and bob). A new test room is created by the admin user, as well as alice and bob were made members by setting their affiliations on the room. (This is the same procedure we use on production for lead/user/agent integrations on the Jabber service) The suite sends then multiple text messagess. The Redis database/queue contains then a job for each sent message.

The test suite was written in JavaScript and is executed by Node.js inside a Docker container. We picked JavaScript here due to the easy and good featured stanza.io client library for XMPP. It got all the things which were needed to fulfil the job.

Additional readings

ejabberd-mam2sidekiq's People

Contributors

dependabot[bot] avatar jack12816 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.