Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8395437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:18:03+00:00 2026-06-09T20:18:03+00:00

I have a java ActiveMQ producer which produces Integer messages into an ObjectMessage instance.

  • 0

I have a java ActiveMQ producer which produces Integer messages into an ObjectMessage instance.

On the python side, I use stomp python for listening on the queue. However, I receive empty message body although all the headers are received right.

Moreover, if I change the message type to TextMessage on the java side, I get correct message on python-consumer side.

I have also tried with PyactiveMQ but with the same effect

Any suggestions will be appreciated!!!

EDIT: Here is a boilerplate java producer code and python subscriber code which i wrote to test stomp on python

public class App 
{
Connection conn;
Session session;
MessageProducer producer;

public void registerPublisher(String queueName, String url) throws JMSException {
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("system", "manager" ,url);
    conn = cf.createConnection();
    conn.start();
    session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Destination destination = session.createQueue(queueName);
    producer = session.createProducer(destination);
    producer.setDeliveryMode(DeliveryMode.PERSISTENT);

}

public void send(int c) {

    for (int i=0; i<c; ++i) {

        try {
            TextMessage tm = session.createTextMessage(new Integer(i).toString());
//              ObjectMessage tm = session.createObjectMessage();
            producer.send(tm);
        } catch (JMSException e) {
            e.printStackTrace();
        }

    }
}

public static void main(String []arg) {
    App app = new App();
    try {
        app.registerPublisher(arg[0], arg[1]);
        System.out.println(app.session);
    } catch (JMSException e) {
        e.printStackTrace();
    }
    app.send(1000);
}


}

And Python Stomp listener

import time
import sys
import logging
import stomp
from stomp import ConnectionListener

queuename = sys.argv[1]

logging.basicConfig( level=logging.DEBUG)

class MyListener(ConnectionListener):
    def on_error(self, headers, message):
        print 'received an error %s' % message

    def onMessage(self, headers, message):
        print headers
        print str(message)
        print type(message)
        print 'received a message ...%s...' % message


conn = stomp.Connection([('localhost', 61613)])                                                                                               
conn.set_listener('', MyListener())
conn.start()
conn.connect()


conn.subscribe(destination='/queue/'+queuename, ack='auto')


while 1:
    time.sleep(2)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:18:05+00:00Added an answer on June 9, 2026 at 8:18 pm

    In order to send an receive ObjectMessage types over Stomp you need to use the message transformation feature of ActiveMQ to have the object payload delivered in a form a STOMP client can understand. ActiveMQ provides XML and JSON transformation support out of the box however you can add your own transformer to get whatever format you want on the content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have java 1.6, maven 2, activeMQ 5.5 and functional tests with testng. When
I'm trying to run ActiveMQ on Mac OSX 10.5.7. I have Java version 1.5.0_19
I have java sdk 1.7. I've always used django/python for web development, this will
I have Java code and TeX documents in the same project. I use TeXlipse
I have Java application which sends pointer to function (callback) to some native dll
I have java.util.LinkedHashMap with Integer as Key and Character as Value. I know the
I have java web application to which I'd like to add emailing capabilities, however,
I have a .net mvc3 site and want to use the ActiveMq amq.js ajax
I have java application which I am running on Unix from the command prompt.
I have a single threaded ActiveMQ consumer written in Java. All I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.