You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by mohank <mo...@eventtracker.com.INVALID> on 2020/07/01 08:40:09 UTC

Re: QPID C++ API : How to check whether Queue/topic has any consumers

Hi Gordon,

printf is dummy one. Inside content when I read the string getting empty.

I have enable the Trace+:Protocol log.
Kindly find the attached log.
myclient.out <http://qpid.2158936.n2.nabble.com/file/t396514/myclient.out>  

Thanks,
Mohan





--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: QPID C++ API : How to check whether Queue/topic has any consumers

Posted by Gordon Sim <gs...@redhat.com>.
On 03/07/2020 6:34 am, mohank wrote:
> After sending utf8 encoded contentobject it is working fine.

Great! Thanks for confirming!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: QPID C++ API : How to check whether Queue/topic has any consumers

Posted by mohank <mo...@eventtracker.com.INVALID>.
Hi Gordon,

Thank you for the help.

After sending utf8 encoded contentobject it is working fine.

Posting working snippet below.

                Sender managementSender =
session.createSender("activemq.management");
		Message requestMessage;
	
		//Working combinations
		//-----------------------------------------------------------------
//1)	
		/*requestMessage.setProperty("_AMQ_ResourceName", "broker");
		requestMessage.setProperty("_AMQ_OperationName", "getQueueNames");*/

		//output
	
/*[["TempQueue","ExpiryQueue","DLQ","318e9e2b-b1b5-4099-958e-0e863621eeff"]]*/
		
//2)  Queue Operations

		/*requestMessage.setProperty("_AMQ_ResourceName", "queue.TempQueue");
		requestMessage.setProperty("_AMQ_OperationName", "getMessageCount"); */

		/*requestMessage.setProperty("_AMQ_ResourceName", "queue.TempQueue");
		requestMessage.setProperty("_AMQ_OperationName", "getConsumerCount");
		*/

		/*requestMessage.setProperty("_AMQ_ResourceName", "queue.TempQueue");
		requestMessage.setProperty("_AMQ_OperationName", "getMaxConsumers");*/
		
		//-----------------------------------------------------------------

		requestMessage.setProperty("_AMQ_ResourceName", "queue.TempQueue");
		requestMessage.setProperty("_AMQ_OperationName", "getMaxConsumers");

		Receiver managementReceiver = session.createReceiver("#");
		Address managementReplyQueue = managementReceiver.getAddress();
		requestMessage.setReplyTo(managementReplyQueue);

		qpid::types::Variant varObj("[]");
		varObj.setEncoding("utf8");
	
		requestMessage.setContentObject(varObj);

		managementSender.send(requestMessage);

Thanks,
Mohan
		



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: QPID C++ API : How to check whether Queue/topic has any consumers

Posted by Gordon Sim <gs...@redhat.com>.
On 01/07/2020 9:40 am, mohank wrote:
> Hi Gordon,
> 
> printf is dummy one. Inside content when I read the string getting empty.
> 
> I have enable the Trace+:Protocol log.
> Kindly find the attached log.
> myclient.out <http://qpid.2158936.n2.nabble.com/file/t396514/myclient.out>

The request message is being sent with a data section and the broker is 
actually rejecting it (rather than putting an error in the response 
which is still sent).

Try sending as a string. You can do that by setting the encoding of the 
Variant that is the ContentObject on the message to be "utf8".


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org