Retrieving ProtobufDescriptorSet

Hi Experts,

I’m new to Universal Messaging, and i’m attempting to write a client which can consume an event from a channel and display it as a Json message. I know that the messages are in the form of Protobuf, however i’m having trouble getting the ProtobufDescriptorSets from the channel attributes. I’m always getting the following error, “Descriptor could not be read”. I have also confirmed that the IS document encoding type is set to Protocol Buffers. Requesting your help to give me a hint on what i could be doing wrong.


UMTracer mySelf = new UMTracer();
			String[] realms = {"nsp://172.30.135.126:9000"};
			nSessionAttributes nsa = new nSessionAttributes(realms, 2);
			nsa.setFollowTheMaster(true);
			nsa.setDisconnectOnClusterFailure(false);
			nsa.setName(mySelf.getClass().getSimpleName());
			nSession mySession = nSessionFactory.create(nsa, mySelf, DEFAULT_USERNAME);
			mySession.addAsyncExceptionListener(mySelf);
			mySession.enableThreading(4);
			mySession.init();
			System.out.println(mySession.getId());
			nChannelAttributes nca = new nChannelAttributes();
			nca.setName("/wm/is/AmGlDocs/Account/AccountProfile/AccountProfileUDM");
			nChannel channel = mySession.findChannel(nca);
			
			System.out.println(channel.getLastEID());
			
			System.out.println(channel.getChannelAttributes().getProtobufDescriptorSets());

Can you set the ACL on the channel to give full access to @ and try run the program? I don’t see any issues with your code.

Thank you for the suggestion Akshith. I have checked the ACL of the channel from the Enterprise manager and @ has full privileges. However, it would be very helpful if you can share with me some sample code on how to set the ACL on the channel. I couldn’t find it on the UM site. I was trying to set the acl using the nACLEntry but received the following error.

Failed to perform the ACL request:SECURITY: No privilege for attempted operation:xxxxxxx@xxxxxx.xx.xxxxxx.xxx Operation : Update Channel ACL

Please find the attached screenshot of the Realm ACL


Can you disable Basic auth on UM, if enabled and then try with below version of code in a wM Java service and share what you see? If you don’t have access to Designer\IS then write a Java program without the references to IData classes(Util and Cursor) in below code and see if it works.


IDataCursor pipelineCursor = pipeline.getCursor();
		String	RNAME = IDataUtil.getString( pipelineCursor, "RNAME" );
		String	channelName = IDataUtil.getString( pipelineCursor, "channelName" );
		pipelineCursor.destroy();
		
		List<String> messages=new ArrayList<String>();
		nSessionAttributes nsa;
		try {
			nsa = new nSessionAttributes(RNAME);
			nSession session=nSessionFactory.create(nsa);
			session.init();
			
			nChannelAttributes nca = new nChannelAttributes();
			nca.setName(channelName);
			nChannel myChannel= session.findChannel(nca);
			
			IDataUtil.put(pipelineCursor, "protBufNames", myChannel.getChannelAttributes().getProtobufDescriptorNames());
		}
		catch(Exception e){
			IDataUtil.put(pipelineCursor, "error", e.toString());
		}

Hi Akshith,

I managed to get the Protobuf using the getProtobufDescriptorSets method in Designer. However, i was not able to get the same results using the same code in eclipse (core java). Is there any settings that i should enable to get the same results in eclipse? Please find the attached for the screenshots of the codes and results.

Thank you.


If this works from IS and not from a standalone Java program then it is definitely an access issue. Can you explicitly add the IP address where the Java Eclipse is installed to the channel and give it full permissions?

Sorry for the late reply on this Akshith, I have tried granting full access to the IP address of the laptop i was running the program. Yet, i was not able to successfully run the program. I also tried running the java program from the same server IS is hosted with negative results. Could it be something other than permission?

I cant think of any other settings that would prevent this from working. I ran this Java code from Eclipse on my desktop and i was able to connect to a remote UM Server and get the descriptors on a channel. I granted the subject @ to Full under ACL’s. I did notice an issue when this subject did not have proper ACL setup.


String  RNAME = "nsp://remotehost:9000"; 
		String  channelName = "/wm/is/test/Akshith/umJava/new_documentType";
                    
        List<String> messages=new ArrayList<String>();  
        nSessionAttributes nsa;  
        try {  
            nsa = new nSessionAttributes(RNAME);  
            nSession session=nSessionFactory.create(nsa);  
            session.init();  
              
            nChannelAttributes nca = new nChannelAttributes();  
            nca.setName(channelName);  
            nChannel myChannel= session.findChannel(nca);  

            String[] output=myChannel.getChannelAttributes().getProtobufDescriptorNames();  
            System.out.println("Prot Buf is "+output[0]); //test
        }  
        catch(Exception e){    
            System.out.println(e.toString());
        }