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 8255937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:41:58+00:00 2026-06-08T01:41:58+00:00

I have given the received message length as 1000000 but still message gets truncated

  • 0

I have given the received message length as 1000000 but still message gets truncated completed code is below

import java.io.FileInputStream;

import javax.jms.JMSException;
import javax.jms.Session;


import com.ibm.jms.JMSMessage;
import com.ibm.jms.JMSTextMessage;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnection;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQQueueReceiver;
import com.ibm.mq.jms.MQQueueSender;
import com.ibm.mq.jms.MQQueueSession;


public class SimplePTP {

  public static void main(String[] args) {
    try {
      MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
String request= null;
      // Config
      cf.setHostName("CTMQ9000");
      cf.setPort(1414);
      cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
      cf.setQueueManager("CTMQTST01");
      cf.setChannel("SYSTEM.ADMIN.SVRCONN");

      MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
      MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      MQQueue queue = (MQQueue) session.createQueue("CONTPLAT.CPS.DELIVERYPREP.REQUEST.TEST");
      MQQueueSender sender =  (MQQueueSender) session.createSender(queue);
      MQQueue queue1 = (MQQueue) session.createQueue("CONTPLAT.CPS.DELIVERYPREP.RESPONSE.TEST");
      MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue1);      

      String request ="sdfHelp Me Name name for Photo Studio!I'm opening a portrait studio in a my town and am stuck on what to name it. I will be photographing (Portrait, wedding Photography)) children and families both at the studio and on location.sdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsdf"
      long uniqueNumber = System.currentTimeMillis() % 1000;
      JMSTextMessage message = (JMSTextMessage) session.createTextMessage(request);     

      // Start the connection
      connection.start();

      sender.send(message);
      System.out.println("Sent message:\\n" + message +"lol");
Thread.sleep(2000);
      JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000000);
      System.out.println("\\nReceived message:\\n" + receivedMessage);

      sender.close();
      receiver.close();
      session.close();
      connection.close();

      System.out.println("\\nSUCCESS\\n");
    }
    catch (JMSException jmsex) {
      System.out.println(jmsex);
      System.out.println("\\nFAILURE\\n");
    }
    catch (Exception ex) {
      System.out.println(ex);
      System.out.println("\\nFAILURE\\n");
    }
  }
}

If the length of the message exceeds some limit i don’t know how much , but its getting truncated , any way to increase or workaround to display complete message.

  • 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-08T01:42:01+00:00Added an answer on June 8, 2026 at 1:42 am

    As Germann pointed out the parameter that you pass to receive method is not the message size, it is actually the wait time in milli seconds. Meaning how long the call must wait for a message to arrive. For example if you have set the wait time as 1000, then the receive call will wait for 1 second for message to arrive. If a message arrives before 1 second, the call will return immediately and give the message to application. If a message does not arrive even after a second, then the call will return with a timeout and no message is given to application. In MQ terms you will see a 2033 reason code.

    How are you determining that the message is truncated? Are you getting a MQRC_TRUNCATED_MESSAGE_FAILED exception? This exception will be thrown if the application supplied buffer is not enough to fill the incoming message. MQ JMS is not expected to throw a MQRC_TRUNCATED_MESSAGE_FAILED exception as it internally handles the buffer size required and returns message to application.

    I am guessing that the issue could be because you are printing a JMSMessage whereas the sent message is a JMSTextMessage. JMSMessage.ToString may not be printing the whole message.

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

Sidebar

Related Questions

I have received forced closed error message on running the sample code of Google
I have given bg image for radio button. It is working in chrome but
I have received this message ever since I started building my first iPhone program
I have some code in an ISR. The code is given for completeness, the
I have some code that calls an API and gets a set of results
In my application perticular message structure/format are send and received. When I have to
I am very new with Python and I have just received this message while
I have a intent receiver in my android manifest, but would like to give
I have given a default value 2.5 for a textbox called diff_Box and then
I have given 100% width to input box to fix to the browser width

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.