Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqueue: new RPC command mqueue.fetch #1760

Merged
merged 1 commit into from Dec 12, 2018

Conversation

jchavanton
Copy link
Member

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

  • PR should be backported to stable branches
  • Tested changes locally
  • Related to issue #XXXX (replace XXXX with an open issue number)

Description

using this new RPC method we can fetch elements key/value from any queue from an external application. This could be useful in many cases, one use case is with acc_json

curl --data-binary '{"jsonrpc":"2.0","id":"1","method":"mqueue.fetch","params": ["MY_QUEUE"]}' -H 'content-type:text/plain;' http://1270.0.1:9999:jsonrpc/ 
{
	"jsonrpc":	"2.0",
	"result":	{
		"key":	"my_key",
		"val":	"{\"time\": 1544217754, \"method\": \"INVITE\","\"}"
	},
	"id":	"1"
}
kamcmd mqueue.fetch my_queue
error: 404 - Empty queue

@miconda
Copy link
Member

miconda commented Dec 11, 2018

Is this fetching from the queue -- get the first item and remove it from queue? Looks like only getting the item (key, value).

@miconda
Copy link
Member

miconda commented Dec 11, 2018

Actually looks ok, with the first look somehow I missed the use of mq_head_fetch() in the rpc command c code ...

@jchavanton
Copy link
Member Author

yes, it is equivalent of scripting command mq_fetch(queue)

@miconda miconda merged commit e4b1131 into kamailio:master Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants