When I login to my chat application I need to join about 20 rooms, but it will take about 1 minute to finish join all room by sending 20 join stanza. I wonder there is a way that I can join 20 rooms just by sending only 1 stanza with 20 room ids?
This is actually possible using XEP-0033 Extended Stanza Addressing. You can see how to do that on this question: How to join multiple rooms by just sending one message to ejabberd server.
Related
I have a #KafkaListener class that listens to a particular topic and consumes records that contain either a Person object or a Phone object (and only one of them). Every Phone has a reference / correlation id to the corresponding Person. The listener class performs certain validations that are specific to the type received, saves the object into a database and produces a transfer success / failed response back to Kafka that is consumed by another service.
So a Person can successfully be transferred without any corresponding Phone, but a Phone transfer should only succeed if the corresponding Person transfer has succeeded. I can't wrap my head around how to implement this "synchronization", because Persons and Phones get into Kafka independently as separate records and it's not guaranteed that the Person corresponding to a particular Phone will be processed before the Phone.
Is it at all possible to have such a synchronization given the current architecture or should I redesign the producer and send a Person / Phone pair as a separate type?
Thanks.
It's not clear how you're using the same serializer for different object types, but you should probably create separate topics and/or branch your current one into two (refer Kafka Streams API)
I assume there are less people than phones, in which case you could build a KTable from a people topic, then as you get phone records, you can perform a left join or lookup against this table for some person ID
Other solutions could involve using Kafka Connect to dump records into a system where you can do the join
Let`s imagine we have server A with publisher and servers B and C with consumers.
Also we have got 5 different subjects; foo1, foo2,... foo5.
We always want to send a message only to one consumer and receive only one response.
So we utilize the requestOne function from the JS SDK at the publisher side and subscribe function with the {queue: "default"} option.
So both servers B and C has been subscribed one time for each subject.
But every time they subscribe they use queue with name "default" to prevent multiple consumers receive the same message as mentioned in docs.
So the question is:
Will this queue with name "default" be shared across all the subjects? Or each subject will have his own queue with name "default" and it is just shared between the subscribers of particular subject.
For example: producer generates 10 messages 2 for each subject.
Will we have 10 messages processed at the same time or only 2 messages since all the subscription share the same queue with name "default"?
You form a queue group based on the queue name that you specify and the subject. So a queue group of "foo" is different than a queue group on "bar".
That being said, with wildcards, you could have multiple subjects being part of the same queue group. That is, 2 members of the group "bar" listening on "foo.*" would split processing of messages sent on "foo.bar", "foo.baz", etc..
The same queue name in different subjects is separate.
You can test it with the examples in the link below.
https://nats.io/documentation/additional_documentation/nats-queueing/
start nats server
gnatsd
sub subject1
go run nats-qsub.go subject1 default
...
sub subject2
go run nats-qsub.go subject2 default
...
pub subject1&2
go run nats-pub.go subject1 "message"
...
go run nats-pub.go subject2 "message"
...
I've been tasked with writing an IRC bot which will join channels on the internal IRC system here, and post messages to channels which don't appear to be used anymore, warning any potential users that the channel is about to be retired. Our IRC system has about 6,500 channels which need these messages posted to them, and the IRC server we use (a customised fork of Hybrid) limits concurrent channel joins to 100 per connection. In an attempt not to hit this limit, the code I've got is this :
if ($channel_list->{$channel}{joined}) {
# If we're already joined, privmsg immediately
$logger->info("Trying to message $channel");
$data_entry->notified('true');
$data_entry->update;
$irc->yield(privmsg => $msg_channel, $message);
$irc->yield(part => $msg_channel);
} else {
# Otherwise join, and let the join event do the privmsg and part
$logger->info("Trying to join $channel");
$data_entry->notified('true');
$data_entry->update;
$irc->yield(join => $msg_channel);
}
i.e. it will see if we're joined already, and if we are, try to post the notification message, and then immediately part. If we're not joined, it tries to join first (and the join event will fire the message sending).
The problem is the code never seems to run the
$irc->yield(part => $msg_channel);
line, as eventually I start getting irc_405 events back from the IRC server saying the code has joined too many channels. Anyone got any idea what am I doing wrong?
Am I right in my understanding of SQL Server (2008 R2 in this case) Service Broker that messages are only batched in terms of conversations? In other words, if I have a query like this:
DECLARE #messages TABLE(
handle UNIQUEIDENTIFIER,
message_body NVARCHAR(MAX),
message_type_name SYSNAME
);
RECEIVE TOP 5
conversation_handle,
message_body,
message_type_name
FROM dbo.MyMessageQueue
INTO #messages
SELECT conversation_handle, message_body FROM #messages
that I will only get five rows returned if they are from the same conversation? At the moment I am sending out my messages one conversation at a time, but if there are ten such messages in the queue, then they are only being returned one at a time.
RECEIVE will dequeue only messages belonging to one conversation group. Unless you do explicit conversation group management, each conversation is its own group. If you only send one message per conversation, then you'll end up RECEIVE-ing only one message every time. This is covered in Conversation Group Locks.
RECEIVE is a fairly expensive statement to run, so for high throughput you must group more messages together, usually via conversation reuse.
My program will take a list of multicast addresses and will join those multicast groups. Later on, the list of addresses may include new multicast addresses. Existing multicast addresses won't be deleted. As a requirement for my program, I cannot interrupt current multicast streams (so I cannot send a "leave" message). I had planned to cycle through list and send join messages to the multicast addresses in my list, without tracking which groups I've already joined. Is this OK?
I saw the post about sending join messages when receiving a Membership Query, but in this instance, I'm not responding to a Membership Query report.
You can join a group multiple times, if that's what you mean. Your description isn't clear. But I don't see what's so hard about knowing which groups are new and which are already current.
The Membership Query message is for UDP and routers, not for applications.