How to get the messages between two users after a particular time stamp in ejabberd through iq stanzas? - ejabberd

Is there any iq stanza in ejabberd that returns messages between two users after a particular timestamp?

If mod_mam is enabled and used to store those messages, take a look at the protocol section 4.1.2 Filtering by time received

Related

How to avoid the automatic deleting of inactive topics in Apache Pulsar

I have an application that produces messages to Pulsar under a specific topic and shut down the application when it's finished; at the same time, no consumer exists to read this topic.
After a while, when I create a consumer and want to read the written data out, I found all data are lost since the topic I've written been deleted by Pulsar.
How can I disable the auto-deletion of inactive topics in Pulsar?
Generally, there are two ways to achieve this.
Firstly, retention policies keep the data for at least X hours (until Y GBs), you could set it via pulsar-admin to infinite at the namespace level.
pulsar-admin namespaces set-retention my-tenant/my-ns \
--size 1T \
--time -1
Secondly, manually set brokerDeleteInactiveTopicsEnabled=false in conf/broker.conf could disable the deletion of inactive topics as well.
It's recommended to set the above two settings simultaneously for proper control.
If you create a subscription on the topic using the Consumer client interface or the REST API, messages are kept until they are acknowledged. An unacknowledged message in a subscription backlog will never be removed, unless you configure a time-to-live (TTL) which will automatically acknowledge the message after some time.
Messages that are not in a subscription or have already been acknowledged are retained in the topic based on the retention policy. You can specify messages to be retained by size or time.
If you want to use a Pulsar topic like a queue that holds all messages until they are acknowledged, which sounds like what you are trying to do, you just need to use the Consumer client interface with a named subscription. Then all your messages will be kept in the topic while your application is inactive. And because the topic still has messages, it won't be automatically deleted (though you can disable that behavior as explained in the answer by yjshen).

How to get rid off ejabberd number of chats limit

I need to make more than 20 muc chats in my ejabberd installation.
By default only limited number of chats can be active.
Are there any ways to get rid of this limit?
If your questions is about the number of chat room a given user can join, you should check option max_user_conferences in mod_muc. See ejabberd mod_muc documentation: https://docs.ejabberd.im/admin/configuration/#mod-muc
If your question is about the max number of resource a given user can connect to ejabberd, you can increase the max_user_sessions limit in your ejabberd ACLs configuration. This is explain in ejabberd documentation: https://docs.ejabberd.im/admin/configuration/#limiting-opened-sessions-with-acl

How to get from Orion all subscriptions inserted by owners

I need to filter subscriptions through logged users (i.e. user_id or organization_id) in a generic context.
The requirements are that any users can manage (edit or delete) only own subscriptions.
As far as I know, there isn't APIs to filter subscriptions by userid, so how can get from orion all subscriptions inserted by owners?
Orion doesn't support the ownership concept in subscriptions. A possible workaround could be to use some descriptive field (in particular, the description field) and a PEP-like proxy using that information to implement a mechanism like the one you want.
At subscription creation time the proxy set the description to the user issuing the creation request.
At subscription modification time, the proxy check if the user issuing the update request matches the one in the description.
The proxy should forbid any attempt of setting/modifying the description field.
Not perfect, but may suffice your case. A proxy like that shouldn't be complex to implement in technologies like Nodejs.

How to deal with multiple request to server from client

I've my messenger app which sends request to server for group creation, server process the request(making a database entry of group) and send back response, but sometimes it happens due to weak connection, response is not received in particular time instant, as a result client sends request again for the same group.
The fault which occurs in this case the server processes both these request and makes two entries (or more in case of more requests) in the database with different group_id for the same group.
How can I avoid multiple entries in database and make it consistent?
Due to multiple entries, when client reinstall app, if there are three entries of a group in database, all three will be loaded in app.
One solution which I thought of is that check if the group with given name already exist, but this is not the accepted solution, since client can create more one group with same name.
Note:
I'm using MYSQL Enterprise edition for storing entries on server.
You can think of group creation as same as groups are created in WhatsApp messenger.
Packet Id is unique for such repeating JSON requests being sent to server. Use that as a filter and discard the duplicate packet Ids. Same as done with message packets and other requests.

How to paginate roster fetch call on ejabberd

I am running my chat service on ejabberd, but after 4-5 months of no downtime, I have come to use case where it's taking a lot of time in fetching rosters for the users whose roster list is too big. At many places it's mentioned that pagination functionality is not present on ejabberd, but is there any way we can optimise it ?
To my knowledge, there is no XMPP specification that define roster pagination. ejabberd does not do anything special in that regard.
What you can look into is XMPP roster versioning (https://xmpp.org/extensions/xep-0237.html), but this is different from pagination.