Sharing client state C Api

Hi all. I am using webmethod 4.1 and the C Api. The OS is HP-UX 11.

I am trying to set a client share state broker and I can’t do it.

I am doing the following:

bcd=awNewBrokerConnectionDescriptor();
b = 1;
awSetDescriptionConnectionShare(bcd,b);
awNewBrokerClient(szBrokerName,szBrokerHost,szClientName,
szClientGroup,szApplName,bcd,&c);

and when I try to set up the share limits, a NO PERMISSION ERROR arises. If I call awGetClientInfoById to retrieve the BrokerClientInfo structure, the value I get of can_share_state field is 0.

Am I missing something??

Thanks.

(Sorry if it is a basic question. I am newbie with webmethods)

Shared state must be set when the client queue on the broker is first created. If the client queue was created on a previous run of the code you listed but didn’t have the awSetDescriptionConnectionShare turned on, you won’t be able to change it. You’ll need to destroy the queue (either via API or with the Administrator tool) and recreate it.

Thank you for you reply, Rob.

I think I can assure that the queue is not created in a previous run by changing the value of the szClientName and using a name that was not previously used, am I right?

Well, I changed the client name parameter (using an unused name) and the error (NO_PERMISSION) raised again. Does my client group need any special permision to do that? Does the broker need any particular setting to allow sharing state between client?

Thank you.

Couple of items of note:

awSetDescriptorConnectionShare sets the connection sharing, not the client state sharing. Use the awSetDescriptorStateShare function to share state. Keep in mind that shared state clients are not useful unless they are receiving events from more than one publisher.

I think the permission error is probably related to something else. AW_ERROR_NO_PERMISSION means permission to join the client_group was denied. Is SSL involved at all? Is the error returned by the awNewBrokerClient call? Or is it later during a subscription attempt? Perhaps posting additional code snippets would reveal something.

Rob, thanks a lot four your time. You make me find the solution. I missed the awSetDescriptorStateShare.

Now it is working fine.

Thank you again.

Hi,Bartoalvarez:
Now,I want to use the C API on wM7.1.2,but failed,so could you please share your code to me,tks,and my email is whg5338680@163.com ,tks in advance.