Failed to select specific worker over consumer tag
up vote
0
down vote
favorite
I have defined worker like this:
...
$this->objChannel->basic_consume(
'QueueDeclare',
'orange',
false,
false,
false,
false,
[$this, 'ProcessClientRequest']
);
...
I have set "orange" as consumer tag.
There are other workers with same declare "QueueDeclare".+ but different consumer tag.
Now I'm trying to send job to that specific worker with "orange" consumer tag.
...
$objMessage = new AMQPMessage(
json_encode($arrWork),
[
'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT,
'consumer_tag' => 'organge',
]
);
...
Problem is when I send couple of times RabbitMQ sends job to all workers, not just to that one with organe consumer tag.
What is my situation?
I have couple of workers running which are creating large files.
Process is in the way that I send for example 500 rows as one task, and till I'm done with job.
Because of that process, it is important to me when I start with job that only one worker receives that specific file.
If worker with orange consumer tag start with file_123, it has to do whole process, it has to receive all rows.
Is really consumer tag made for that or there is something else?
I have shown above only code which is important for this explanation.
Thank you in advance
UPDATE 1:
I can see on queue list that every worker/connection has consumer_tag and also in clients message.
UPDATE 2:
Or maybe I can select specific channel when there are couple of them with same queue?
rabbitmq
add a comment |
up vote
0
down vote
favorite
I have defined worker like this:
...
$this->objChannel->basic_consume(
'QueueDeclare',
'orange',
false,
false,
false,
false,
[$this, 'ProcessClientRequest']
);
...
I have set "orange" as consumer tag.
There are other workers with same declare "QueueDeclare".+ but different consumer tag.
Now I'm trying to send job to that specific worker with "orange" consumer tag.
...
$objMessage = new AMQPMessage(
json_encode($arrWork),
[
'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT,
'consumer_tag' => 'organge',
]
);
...
Problem is when I send couple of times RabbitMQ sends job to all workers, not just to that one with organe consumer tag.
What is my situation?
I have couple of workers running which are creating large files.
Process is in the way that I send for example 500 rows as one task, and till I'm done with job.
Because of that process, it is important to me when I start with job that only one worker receives that specific file.
If worker with orange consumer tag start with file_123, it has to do whole process, it has to receive all rows.
Is really consumer tag made for that or there is something else?
I have shown above only code which is important for this explanation.
Thank you in advance
UPDATE 1:
I can see on queue list that every worker/connection has consumer_tag and also in clients message.
UPDATE 2:
Or maybe I can select specific channel when there are couple of them with same queue?
rabbitmq
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have defined worker like this:
...
$this->objChannel->basic_consume(
'QueueDeclare',
'orange',
false,
false,
false,
false,
[$this, 'ProcessClientRequest']
);
...
I have set "orange" as consumer tag.
There are other workers with same declare "QueueDeclare".+ but different consumer tag.
Now I'm trying to send job to that specific worker with "orange" consumer tag.
...
$objMessage = new AMQPMessage(
json_encode($arrWork),
[
'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT,
'consumer_tag' => 'organge',
]
);
...
Problem is when I send couple of times RabbitMQ sends job to all workers, not just to that one with organe consumer tag.
What is my situation?
I have couple of workers running which are creating large files.
Process is in the way that I send for example 500 rows as one task, and till I'm done with job.
Because of that process, it is important to me when I start with job that only one worker receives that specific file.
If worker with orange consumer tag start with file_123, it has to do whole process, it has to receive all rows.
Is really consumer tag made for that or there is something else?
I have shown above only code which is important for this explanation.
Thank you in advance
UPDATE 1:
I can see on queue list that every worker/connection has consumer_tag and also in clients message.
UPDATE 2:
Or maybe I can select specific channel when there are couple of them with same queue?
rabbitmq
I have defined worker like this:
...
$this->objChannel->basic_consume(
'QueueDeclare',
'orange',
false,
false,
false,
false,
[$this, 'ProcessClientRequest']
);
...
I have set "orange" as consumer tag.
There are other workers with same declare "QueueDeclare".+ but different consumer tag.
Now I'm trying to send job to that specific worker with "orange" consumer tag.
...
$objMessage = new AMQPMessage(
json_encode($arrWork),
[
'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT,
'consumer_tag' => 'organge',
]
);
...
Problem is when I send couple of times RabbitMQ sends job to all workers, not just to that one with organe consumer tag.
What is my situation?
I have couple of workers running which are creating large files.
Process is in the way that I send for example 500 rows as one task, and till I'm done with job.
Because of that process, it is important to me when I start with job that only one worker receives that specific file.
If worker with orange consumer tag start with file_123, it has to do whole process, it has to receive all rows.
Is really consumer tag made for that or there is something else?
I have shown above only code which is important for this explanation.
Thank you in advance
UPDATE 1:
I can see on queue list that every worker/connection has consumer_tag and also in clients message.
UPDATE 2:
Or maybe I can select specific channel when there are couple of them with same queue?
rabbitmq
rabbitmq
edited Nov 23 at 10:26
asked Nov 22 at 17:24
iWizard
3,292115290
3,292115290
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Found solution (I'm sure there are other solutions but this one worked for me).
For every worker define two "QueueDeclare", one which will be same for all workers and one random, for example uniqid().
On first send message to common "QueueDeclare" and resolve if that was init message, if it was save somewhere random name so client can grab it and send real work on it.
After that client can send unlimited messages to that same worker.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435817%2ffailed-to-select-specific-worker-over-consumer-tag%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Found solution (I'm sure there are other solutions but this one worked for me).
For every worker define two "QueueDeclare", one which will be same for all workers and one random, for example uniqid().
On first send message to common "QueueDeclare" and resolve if that was init message, if it was save somewhere random name so client can grab it and send real work on it.
After that client can send unlimited messages to that same worker.
add a comment |
up vote
0
down vote
accepted
Found solution (I'm sure there are other solutions but this one worked for me).
For every worker define two "QueueDeclare", one which will be same for all workers and one random, for example uniqid().
On first send message to common "QueueDeclare" and resolve if that was init message, if it was save somewhere random name so client can grab it and send real work on it.
After that client can send unlimited messages to that same worker.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Found solution (I'm sure there are other solutions but this one worked for me).
For every worker define two "QueueDeclare", one which will be same for all workers and one random, for example uniqid().
On first send message to common "QueueDeclare" and resolve if that was init message, if it was save somewhere random name so client can grab it and send real work on it.
After that client can send unlimited messages to that same worker.
Found solution (I'm sure there are other solutions but this one worked for me).
For every worker define two "QueueDeclare", one which will be same for all workers and one random, for example uniqid().
On first send message to common "QueueDeclare" and resolve if that was init message, if it was save somewhere random name so client can grab it and send real work on it.
After that client can send unlimited messages to that same worker.
answered Nov 27 at 10:20
iWizard
3,292115290
3,292115290
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435817%2ffailed-to-select-specific-worker-over-consumer-tag%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown