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 <[email protected]>
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 <[email protected]> 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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to