You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by bgercken <bg...@gmail.com> on 2016/10/19 00:06:00 UTC

qpid-jms with C++ Broker - Does it support ByteMessage types from java?

Hi 

I am using qpid-jms (qpid-jms-client-0.20.0-SNAPSHOT.jar) with the C++ qpid
broker version 0.34 from java.

I can successfully package and receive standard Message and TextMessage
types but when I try to use a ByteMessage or a MapMessage type I never
receive the message.

I have included two examples below. I can provide more information if
needed. I am hoping this is something simple that I am doing wrong.

Thanks.
-bill

THIS WORKS:

	public void publishHostFinished( String hostName, String clientType,
boolean success, String result ) {
		try {
			TextMessage message = session.createTextMessage();
			message.setBooleanProperty( "finished_state", success);
			message.setStringProperty( "finished_result", result );
			message.setStringProperty( "message_type", "FINISHED" );
			publishHostTextMessage( message, hostName, clientType, null );
		}
		catch( JMSException e ) {
			log.error( "Error while publishing finished for {} client {}: {}",
hostName, clientType, e.getLocalizedMessage() );
		}
	}

private void publishHostTextMessage( TextMessage message, String hostName,
String clientType, String body ) throws JMSException {
		message.setStringProperty( "host", hostName );
		message.setStringProperty( "client_type", clientType );
		message.setText( body );				
		publisher.publish( message ); 
	}

WHERE THIS WON'T:

// TEST MESSAGE 
public void publishBufferedMessage( ) {
		
		
		System.out.println( "****************** PUBLISH BUFFERD MESSAGE
*************************" );
		
		Drive.Builder drive = Drive.newBuilder();
		
		drive.setSerial( "123-456-789" );
		drive.setComments( "This is drive: sda" );
		drive.setId(123);
		drive.setLabel( "DRIVE_LABEL" );
		
		drive.build();
		
		try {
		
		BytesMessage message = session.createBytesMessage();
		
		int messageSize = drive.build().getSerializedSize();
		
		message.setStringProperty( "message_type", "DRIVE_DATA" );
		message.setIntProperty( "message_encoded_size", messageSize );
		
		/**
		byte[] encodedMessage = new byte[messageSize];
		
		encodedMessage = drive.build().toByteArray();
		
		message.writeBytes( encodedMessage );
		**/
		
		publisher.publish( message );
		
		}
		catch( JMSException jmse ) {
			System.out.println( "error while publishing buffered message: " +
jmse.getLocalizedMessage() );
		}
	}





--
View this message in context: http://qpid.2158936.n2.nabble.com/qpid-jms-with-C-Broker-Does-it-support-ByteMessage-types-from-java-tp7652144.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

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


Re: qpid-jms with C++ Broker - Does it support ByteMessage types from java?

Posted by Bill Gercken <bg...@gmail.com>.
Thanks Robbie,

I think that is the direction I am going to go in this morning (create a
separate stand alone example) to see if I can resolve the issue.

It may be something with the class path in my project as there are other
message classes using the proton API for other work.

The other thing that is weird, is that when I do produce ByteMessages my
consumer goes bonkers and gets into a GC frenzy and eventually produces a  GC
overhead message shown below.

Hopefully, the stand alone version will work and it is related to something
else. I will post future questions to the users list.

Thanks again,
-bill


Connection ExceptionListener fired, exiting.
javax.jms.JMSException: GC overhead limit exceeded
    at
org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:86)
    at
org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:108)
    at
org.apache.qpid.jms.JmsConnection.onAsyncException(JmsConnection.java:1362)
    at
org.apache.qpid.jms.JmsConnection.onProviderException(JmsConnection.java:1346)
    at
org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1219)
    at
org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:922)
    at
org.apache.qpid.jms.provider.amqp.AmqpProvider$18.run(AmqpProvider.java:719)
    at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: GC overhead limit exceeded
    at
org.apache.qpid.jms.util.IOExceptionSupport.create(IOExceptionSupport.java:45)
    ... 9 more
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at
io.netty.buffer.UnpooledHeapByteBuf.<init>(UnpooledHeapByteBuf.java:46)
    at
io.netty.buffer.UnpooledUnsafeHeapByteBuf.<init>(UnpooledUnsafeHeapByteBuf.java:29)
    at
io.netty.buffer.UnpooledByteBufAllocator.newHeapBuffer(UnpooledByteBufAllocator.java:59)
    at
io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:160)
    at
io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:151)
    at
org.apache.qpid.jms.transports.netty.PartialPooledByteBufAllocator.ioBuffer(PartialPooledByteBufAllocator.java:70)
    at
io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:73)
    at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:117)
    at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:610)
    at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:551)
    at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:465)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:437)
    at
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
    at
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
    ... 1 more


On Wed, Oct 19, 2016 at 8:29 AM, Robbie Gemmell <ro...@gmail.com>
wrote:

> I'm not aware of any issues doing this, and I just modified the
> HelloWorld example to use BytesMessage (with and without writing
> content) and ran it against the 1.35.0 C++ broker without issue. I'd
> be surprised if the older broker made a difference, but its possible I
> guess.
>
> Perhaps you can try looking at the logs to see if anything pops out.
> Beyond the regular logging, if you run the client or broker with
> PN_TRACE_FRM=true environment variable set you should see some
> protocol trace logging to the console from Proton (which they both use
> for their AMQP 1.0 support) which may further help in seeing whats
> going on.
>
> Questions like this are better suited to the users@ list rather than
> dev@, plus theres a bigger audience and less other activity happening
> to get in the way there.
>
> Robbie
>
> On 19 October 2016 at 01:06, bgercken <bg...@gmail.com> wrote:
> > Hi
> >
> > I am using qpid-jms (qpid-jms-client-0.20.0-SNAPSHOT.jar) with the C++
> qpid
> > broker version 0.34 from java.
> >
> > I can successfully package and receive standard Message and TextMessage
> > types but when I try to use a ByteMessage or a MapMessage type I never
> > receive the message.
> >
> > I have included two examples below. I can provide more information if
> > needed. I am hoping this is something simple that I am doing wrong.
> >
> > Thanks.
> > -bill
> >
> > THIS WORKS:
> >
> >         public void publishHostFinished( String hostName, String
> clientType,
> > boolean success, String result ) {
> >                 try {
> >                         TextMessage message =
> session.createTextMessage();
> >                         message.setBooleanProperty( "finished_state",
> success);
> >                         message.setStringProperty( "finished_result",
> result );
> >                         message.setStringProperty( "message_type",
> "FINISHED" );
> >                         publishHostTextMessage( message, hostName,
> clientType, null );
> >                 }
> >                 catch( JMSException e ) {
> >                         log.error( "Error while publishing finished for
> {} client {}: {}",
> > hostName, clientType, e.getLocalizedMessage() );
> >                 }
> >         }
> >
> > private void publishHostTextMessage( TextMessage message, String
> hostName,
> > String clientType, String body ) throws JMSException {
> >                 message.setStringProperty( "host", hostName );
> >                 message.setStringProperty( "client_type", clientType );
> >                 message.setText( body );
> >                 publisher.publish( message );
> >         }
> >
> > WHERE THIS WON'T:
> >
> > // TEST MESSAGE
> > public void publishBufferedMessage( ) {
> >
> >
> >                 System.out.println( "****************** PUBLISH BUFFERD
> MESSAGE
> > *************************" );
> >
> >                 Drive.Builder drive = Drive.newBuilder();
> >
> >                 drive.setSerial( "123-456-789" );
> >                 drive.setComments( "This is drive: sda" );
> >                 drive.setId(123);
> >                 drive.setLabel( "DRIVE_LABEL" );
> >
> >                 drive.build();
> >
> >                 try {
> >
> >                 BytesMessage message = session.createBytesMessage();
> >
> >                 int messageSize = drive.build().getSerializedSize();
> >
> >                 message.setStringProperty( "message_type", "DRIVE_DATA"
> );
> >                 message.setIntProperty( "message_encoded_size",
> messageSize );
> >
> >                 /**
> >                 byte[] encodedMessage = new byte[messageSize];
> >
> >                 encodedMessage = drive.build().toByteArray();
> >
> >                 message.writeBytes( encodedMessage );
> >                 **/
> >
> >                 publisher.publish( message );
> >
> >                 }
> >                 catch( JMSException jmse ) {
> >                         System.out.println( "error while publishing
> buffered message: " +
> > jmse.getLocalizedMessage() );
> >                 }
> >         }
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://qpid.2158936.n2.nabble.
> com/qpid-jms-with-C-Broker-Does-it-support-ByteMessage-
> types-from-java-tp7652144.html
> > Sent from the Apache Qpid developers mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: dev-help@qpid.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>

Re: qpid-jms with C++ Broker - Does it support ByteMessage types from java?

Posted by Bill Gercken <bg...@gmail.com>.
Figured out the issue. Coding error.

In my onMessage loop I was assigning the message to a TextMessage without
checking the instancof the message class. (I was using mostly TextMessages
when I started.)

Instead of throwing an exception it would just fail the assignment and
return from the method, which was causing the message to be continuously
re-delivered eventually using up all of the memory on my subscriber.

Thanks.
-bill


On Wed, Oct 19, 2016 at 8:29 AM, Robbie Gemmell <ro...@gmail.com>
wrote:

> I'm not aware of any issues doing this, and I just modified the
> HelloWorld example to use BytesMessage (with and without writing
> content) and ran it against the 1.35.0 C++ broker without issue. I'd
> be surprised if the older broker made a difference, but its possible I
> guess.
>
> Perhaps you can try looking at the logs to see if anything pops out.
> Beyond the regular logging, if you run the client or broker with
> PN_TRACE_FRM=true environment variable set you should see some
> protocol trace logging to the console from Proton (which they both use
> for their AMQP 1.0 support) which may further help in seeing whats
> going on.
>
> Questions like this are better suited to the users@ list rather than
> dev@, plus theres a bigger audience and less other activity happening
> to get in the way there.
>
> Robbie
>
> On 19 October 2016 at 01:06, bgercken <bg...@gmail.com> wrote:
> > Hi
> >
> > I am using qpid-jms (qpid-jms-client-0.20.0-SNAPSHOT.jar) with the C++
> qpid
> > broker version 0.34 from java.
> >
> > I can successfully package and receive standard Message and TextMessage
> > types but when I try to use a ByteMessage or a MapMessage type I never
> > receive the message.
> >
> > I have included two examples below. I can provide more information if
> > needed. I am hoping this is something simple that I am doing wrong.
> >
> > Thanks.
> > -bill
> >
> > THIS WORKS:
> >
> >         public void publishHostFinished( String hostName, String
> clientType,
> > boolean success, String result ) {
> >                 try {
> >                         TextMessage message =
> session.createTextMessage();
> >                         message.setBooleanProperty( "finished_state",
> success);
> >                         message.setStringProperty( "finished_result",
> result );
> >                         message.setStringProperty( "message_type",
> "FINISHED" );
> >                         publishHostTextMessage( message, hostName,
> clientType, null );
> >                 }
> >                 catch( JMSException e ) {
> >                         log.error( "Error while publishing finished for
> {} client {}: {}",
> > hostName, clientType, e.getLocalizedMessage() );
> >                 }
> >         }
> >
> > private void publishHostTextMessage( TextMessage message, String
> hostName,
> > String clientType, String body ) throws JMSException {
> >                 message.setStringProperty( "host", hostName );
> >                 message.setStringProperty( "client_type", clientType );
> >                 message.setText( body );
> >                 publisher.publish( message );
> >         }
> >
> > WHERE THIS WON'T:
> >
> > // TEST MESSAGE
> > public void publishBufferedMessage( ) {
> >
> >
> >                 System.out.println( "****************** PUBLISH BUFFERD
> MESSAGE
> > *************************" );
> >
> >                 Drive.Builder drive = Drive.newBuilder();
> >
> >                 drive.setSerial( "123-456-789" );
> >                 drive.setComments( "This is drive: sda" );
> >                 drive.setId(123);
> >                 drive.setLabel( "DRIVE_LABEL" );
> >
> >                 drive.build();
> >
> >                 try {
> >
> >                 BytesMessage message = session.createBytesMessage();
> >
> >                 int messageSize = drive.build().getSerializedSize();
> >
> >                 message.setStringProperty( "message_type", "DRIVE_DATA"
> );
> >                 message.setIntProperty( "message_encoded_size",
> messageSize );
> >
> >                 /**
> >                 byte[] encodedMessage = new byte[messageSize];
> >
> >                 encodedMessage = drive.build().toByteArray();
> >
> >                 message.writeBytes( encodedMessage );
> >                 **/
> >
> >                 publisher.publish( message );
> >
> >                 }
> >                 catch( JMSException jmse ) {
> >                         System.out.println( "error while publishing
> buffered message: " +
> > jmse.getLocalizedMessage() );
> >                 }
> >         }
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://qpid.2158936.n2.nabble.
> com/qpid-jms-with-C-Broker-Does-it-support-ByteMessage-
> types-from-java-tp7652144.html
> > Sent from the Apache Qpid developers mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: dev-help@qpid.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>

Re: qpid-jms with C++ Broker - Does it support ByteMessage types from java?

Posted by Robbie Gemmell <ro...@gmail.com>.
I'm not aware of any issues doing this, and I just modified the
HelloWorld example to use BytesMessage (with and without writing
content) and ran it against the 1.35.0 C++ broker without issue. I'd
be surprised if the older broker made a difference, but its possible I
guess.

Perhaps you can try looking at the logs to see if anything pops out.
Beyond the regular logging, if you run the client or broker with
PN_TRACE_FRM=true environment variable set you should see some
protocol trace logging to the console from Proton (which they both use
for their AMQP 1.0 support) which may further help in seeing whats
going on.

Questions like this are better suited to the users@ list rather than
dev@, plus theres a bigger audience and less other activity happening
to get in the way there.

Robbie

On 19 October 2016 at 01:06, bgercken <bg...@gmail.com> wrote:
> Hi
>
> I am using qpid-jms (qpid-jms-client-0.20.0-SNAPSHOT.jar) with the C++ qpid
> broker version 0.34 from java.
>
> I can successfully package and receive standard Message and TextMessage
> types but when I try to use a ByteMessage or a MapMessage type I never
> receive the message.
>
> I have included two examples below. I can provide more information if
> needed. I am hoping this is something simple that I am doing wrong.
>
> Thanks.
> -bill
>
> THIS WORKS:
>
>         public void publishHostFinished( String hostName, String clientType,
> boolean success, String result ) {
>                 try {
>                         TextMessage message = session.createTextMessage();
>                         message.setBooleanProperty( "finished_state", success);
>                         message.setStringProperty( "finished_result", result );
>                         message.setStringProperty( "message_type", "FINISHED" );
>                         publishHostTextMessage( message, hostName, clientType, null );
>                 }
>                 catch( JMSException e ) {
>                         log.error( "Error while publishing finished for {} client {}: {}",
> hostName, clientType, e.getLocalizedMessage() );
>                 }
>         }
>
> private void publishHostTextMessage( TextMessage message, String hostName,
> String clientType, String body ) throws JMSException {
>                 message.setStringProperty( "host", hostName );
>                 message.setStringProperty( "client_type", clientType );
>                 message.setText( body );
>                 publisher.publish( message );
>         }
>
> WHERE THIS WON'T:
>
> // TEST MESSAGE
> public void publishBufferedMessage( ) {
>
>
>                 System.out.println( "****************** PUBLISH BUFFERD MESSAGE
> *************************" );
>
>                 Drive.Builder drive = Drive.newBuilder();
>
>                 drive.setSerial( "123-456-789" );
>                 drive.setComments( "This is drive: sda" );
>                 drive.setId(123);
>                 drive.setLabel( "DRIVE_LABEL" );
>
>                 drive.build();
>
>                 try {
>
>                 BytesMessage message = session.createBytesMessage();
>
>                 int messageSize = drive.build().getSerializedSize();
>
>                 message.setStringProperty( "message_type", "DRIVE_DATA" );
>                 message.setIntProperty( "message_encoded_size", messageSize );
>
>                 /**
>                 byte[] encodedMessage = new byte[messageSize];
>
>                 encodedMessage = drive.build().toByteArray();
>
>                 message.writeBytes( encodedMessage );
>                 **/
>
>                 publisher.publish( message );
>
>                 }
>                 catch( JMSException jmse ) {
>                         System.out.println( "error while publishing buffered message: " +
> jmse.getLocalizedMessage() );
>                 }
>         }
>
>
>
>
>
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/qpid-jms-with-C-Broker-Does-it-support-ByteMessage-types-from-java-tp7652144.html
> Sent from the Apache Qpid developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>

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