The following code gives "unable to open stack traces error" I am try
to send data from Java Client on Android to Java File (https://
github.com/rabbitmq/rabbitmq-tutorials/blob/master/java/Recv.java)

I have also included the permissions of "write_external_storage" and
"internet". If I disable the "handler.post(send)" then it doesn't
gives the error but the job is not done.

Android Code:

TextView mOutput;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mOutput = (TextView) findViewById(R.id.output);

Handler handler = new Handler();

Runnable send = new Runnable(){
public void run() {
// TODO Auto-generated method stub
send();
}
};
mOutput.append("/nBefore");
handler.post(send);
mOutput.append("/nAfter");
}

private void send(){
Thread thread = new Thread(){
@Override
public void run(){
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("sethost");
Connection connection = null;
try {
connection = factory.newConnection();
mOutput.append("/ninstance1");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Channel channel = null;
try {
mOutput.append("/ninstance2");
channel = connection.createChannel();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

try {
mOutput.append("/ninstance3");
channel.queueDeclare("hello", false, false, false,
null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

String message = "Kamran Android E";
try {
mOutput.append("/ninstance4");
channel.basicPublish("logs","hello", null,
message.getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
thread.start();
}
}

Search Discussions

  • Emile Joubert at Feb 20, 2012 at 5:28 pm
    Hi,
    On 20/02/12 16:56, Kamran wrote:
    The following code gives "unable to open stack traces error"
    That sounds like a problem in your development environment. I don't know
    how many Android experts are on this list but you might not get a reply
    to that issue here.

    If your error is associated with an entry in the broker logfile, or if
    the error originates in the RabbitMQ client or broker then we'll be
    better able to help you. You should narrow down the scope of the issue
    until it is clearer where the problem lies.



    -Emile
  • Kamran at Feb 20, 2012 at 7:52 pm
    I hope I am not bothering you too much. Actually the following code
    also gives the same error, my question is there any sample code where
    java client on android is publishing?

    public class ActivityHome extends Activity {
    private MessageConsumer mConsumer;
    private TextView mOutput;
    private final static String QUEUE_NAME = "hello";
    private final static String EXCHANGE_NAME = "logs";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mOutput.append("Kamran");
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("sethost");
    try{
    mOutput.append("Sending");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.queueDeclare(QUEUE_NAME, false, false, false, null);
    String message = "Kamran Android E";
    channel.basicPublish(EXCHANGE_NAME, "", null,
    message.getBytes());
    System.out.println(" [x] Sent '" + message + "'");
    }
    catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    mOutput.append("\nSent");
    }

    @Override
    protected void onResume() {
    super.onPause();
    mConsumer.connectToRabbitMQ();
    }

    @Override
    protected void onPause() {
    super.onPause();
    mConsumer.dispose();
    }
    }
    On Feb 20, 6:28?pm, Emile Joubert wrote:
    Hi,
    On 20/02/12 16:56, Kamran wrote:

    The following code gives "unable to open stack traces error"
    That sounds like a problem in your development environment. I don't know
    how many Android experts are on this list but you might not get a reply
    to that issue here.

    If your error is associated with an entry in the broker logfile, or if
    the error originates in the RabbitMQ client or broker then we'll be
    better able to help you. You should narrow down the scope of the issue
    until it is clearer where the problem lies.

    -Emile
    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
  • Emile Joubert at Feb 20, 2012 at 8:52 pm

    On 20/02/12 19:52, Kamran wrote:
    is there any sample code where
    java client on android is publishing?
    Not that I know of, other than the blog post you quoted earlier.


    -Emile
  • Bell, Paul M. at Aug 1, 2012 at 3:10 am
    Hi All,

    Is there a limit on the number of distinct bindings a consumer can establish when binding a queue to a topic exchange with a binding key?

    It's my understanding, based on what I've learned here, that if a publisher publishes a message to an exchange and outbound from that exchange there is no binding, then the broker will simply discard the message. If there's no one listening (as it were) at the time of publication, then no one gets the message.

    Around this phenomenon arises the question of somehow determining that there's an active consumer before publishing a message. The use case here is that these messages represent tasks that need to be run by the consumer. Perhaps these messages will be written by some kind of task scheduler. The point is that I don't want to publish the messages unless I know that a consumer is present and can act upon them.

    I suppose this is where the "mandatory" flag comes in. But I'm wondering if there's a way to query the broker about its infrastructure, e.g., the existence of a queue/binding that would indicate the presence of the consumer.

    Thank you.

    -Paul



    ATTENTION: -----

    The information contained in this message (including any files transmitted with this message) may contain proprietary, trade secret or other confidential and/or legally privileged information. Any pricing information contained in this message or in any files transmitted with this message is always confidential and cannot be shared with any third parties without prior written approval from Syncsort. This message is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any use, disclosure, copying or distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and/or Syncsort and destroy all copies of this message in your possession, custody or control.
  • Tim Watson at Aug 1, 2012 at 7:23 am
    On 1 Aug 2012, at 04:10, "Bell, Paul M." <pbell@syncsort.com> .
    I suppose this is where the "mandatory" flag comes in. But I'm wondering if there's a way to query the broker about its infrastructure, e.g., the existence of a queue/binding that would indicate the presence of the consumer.
    There are ways to query the infrastructure, but these rare generally not exposed to client APIs. What client are you using?
    Thank you.

    -Paul



    ATTENTION: -----

    The information contained in this message (including any files transmitted with this message) may contain proprietary, trade secret or other confidential and/or legally privileged information. Any pricing information contained in this message or in any files transmitted with this message is always confidential and cannot be shared with any third parties without prior written approval from Syncsort. This message is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any use, disclosure, copying or distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and/or Syncsort and destroy all copies of this message in your possession, custody or control.
    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
  • Matthias Radestock at Aug 1, 2012 at 8:08 am

    On 01/08/12 08:23, Tim Watson wrote:
    On 1 Aug 2012, at 04:10, "Bell, Paul M." <pbell@syncsort.com> .
    I suppose this is where the "mandatory" flag comes in. But I'm
    wondering if there's a way to query the broker about its
    infrastructure, e.g., the existence of a queue/binding that would
    indicate the presence of the consumer.
    There are ways to query the infrastructure, but these rare generally
    not exposed to client APIs. What client are you using?
    Moreover, performing such a "does a consumer exists?" query before
    publishing is racy, since the consumer might well vanish between the
    query and the publishing event.

    What are you actually trying to accomplish? Is the idea that in the
    absence of consumers the producer would hang on to the message and retry
    later? In that case you may want to consider alternative routing
    topologies. E.g. perhaps the consumer queues could be declared ahead of
    time. Or you could use an alternate exchange to route messages to
    holding queue where they are then picked up from consumers when they
    join. Or you could do something even more sophisticated and configure
    said holding queue with a message-ttl and set the original exchange as
    the dead-letter exchange of the queue - that way messages will be
    retried periodically automatically.

    Matthias.
  • Bell, Paul M. at Aug 8, 2012 at 10:06 pm
    Tim and Matthias,

    Thank you for your replies. Sorry I didn't get back to you sooner.

    I do understand that the instant I determine (query the infrastructure) that the consumer is up, it might go down.

    I am trying to prevent a "job start" message from being published when there is no consumer to receive that message. In the normal course of events, with the consumer up, receipt of such a message would cause the consumer to run the job requested by the message.

    It is far more preferable to complain up front that there is no consumer (and that therefore the job won't be run) than it is to have the broker silently discard the message.

    I will think about the alternative routing topologies Matthias suggests. But what's wrong with using the mandatory flag - is it not applicable for the case I describe?

    Cordially,

    Paul

    -----Original Message-----
    From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Matthias Radestock
    Sent: Wednesday, August 01, 2012 4:09 AM
    To: rabbitmq-discuss at lists.rabbitmq.com
    Subject: Re: [rabbitmq-discuss] Two questions: max bindings and handling noconsumer present
    On 01/08/12 08:23, Tim Watson wrote:

    On 1 Aug 2012, at 04:10, "Bell, Paul M." <pbell@syncsort.com> .
    I suppose this is where the "mandatory" flag comes in. But I'm
    wondering if there's a way to query the broker about its
    infrastructure, e.g., the existence of a queue/binding that would
    indicate the presence of the consumer.
    There are ways to query the infrastructure, but these rare generally
    not exposed to client APIs. What client are you using?
    Moreover, performing such a "does a consumer exists?" query before
    publishing is racy, since the consumer might well vanish between the
    query and the publishing event.

    What are you actually trying to accomplish? Is the idea that in the
    absence of consumers the producer would hang on to the message and retry
    later? In that case you may want to consider alternative routing
    topologies. E.g. perhaps the consumer queues could be declared ahead of
    time. Or you could use an alternate exchange to route messages to
    holding queue where they are then picked up from consumers when they
    join. Or you could do something even more sophisticated and configure
    said holding queue with a message-ttl and set the original exchange as
    the dead-letter exchange of the queue - that way messages will be
    retried periodically automatically.

    Matthias.
    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



    ATTENTION: -----

    The information contained in this message (including any files transmitted with this message) may contain proprietary, trade secret or other confidential and/or legally privileged information. Any pricing information contained in this message or in any files transmitted with this message is always confidential and cannot be shared with any third parties without prior written approval from Syncsort. This message is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any use, disclosure, copying or distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and/or Syncsort and destroy all copies of this message in your possession, custody or control.
  • Matthias Radestock at Aug 9, 2012 at 7:58 am

    On 08/08/12 23:06, Bell, Paul M. wrote:
    I will think about the alternative routing topologies Matthias
    suggests. But what's wrong with using the mandatory flag - is it not
    applicable for the case I describe?
    The problem is that it's racy. There may be a connected consumer and
    associated queue at the time the message is routed - which is what
    'mandatory' is checking - but then said consumer might disconnect before
    rabbit had a chance to send it the message.

    Thinking about it though, employing an alternate exchange suffers from
    the same problem.

    Not deleting the queues when consumers disconnect (i.e. not using
    exclusive queues), is about the only solution I can think of that won't
    result in the message being silently discarded in the above scenario,
    but that may not fit in with what you want to accomplish.

    Regards,

    Matthias.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedFeb 20, '12 at 4:56p
activeAug 9, '12 at 7:58a
posts9
users5
websiterabbitmq.com
irc#rabbitmq

People

Translate

site design / logo © 2022 Grokbase