Package flex.messaging

Examples of flex.messaging.MessageException


        {
            throw ex;
        }
        catch (Throwable ex)
        {
            throw new MessageException(ex);
        }
        finally
        {
            try
            {
View Full Code Here


      return getTemperature(zipCode);
    }

    public String generateMessageExceptionWithExtendedData(String extraData)
    {      
        MessageException me = new MessageException("Testing extendedData.");
        Map extendedData = new HashMap();
        // The test method that invokes this expects an "extraData" slot in this map.
        extendedData.put("extraData", extraData);
        me.setExtendedData(extendedData);
        me.setCode("999");
        me.setDetails("Some custom details.");
        throw me;
    }
View Full Code Here

        }
        catch (Throwable t)
        {
            // this should never happen- ErrorFilter should catch everything
            t.printStackTrace();
            throw new MessageException(t.toString());
        }
    }
View Full Code Here

            //TODO: QUESTION: Pete Support default soap endpoints?
            //String url = settings.getParsedDefaultUrl(contextPath);
            //message.setUrl(url);

            // FIXME: Need a better error here!
            throw new MessageException("A SOAP endpoint was not provided.");
        }

        return adapter.invoke(message);
    }
View Full Code Here

public class testException {
   
    public String generateMessageExceptionWithExtendedData(String extraData)
    {      
        MessageException me = new MessageException("Testing extendedData.");
        Map extendedData = new HashMap();
        // The test method that invokes this expects an "extraData" slot in this map.
        extendedData.put("extraData", extraData);
        me.setExtendedData(extendedData);
        me.setCode("999");
        me.setDetails("Some custom details.");
        throw me;
    }   
View Full Code Here

     * @param pollCommand The poll command from the client.
     * @return The flush info used to build the poll response.
     */
    protected FlushResult handleFlexClientPoll(FlexClient flexClient, CommandMessage pollCommand)
    {
        MessageException me = new MessageException();
        me.setMessage(POLL_NOT_SUPPORTED_MESSAGE);
        me.setDetails(POLL_NOT_SUPPORTED_MESSAGE);
        me.setCode(POLL_NOT_SUPPORTED_CODE);
        throw me;
    }
View Full Code Here

                break;
            case CommandMessage.LOGOUT_OPERATION:
                lm.logout();
                break;
            default:
                throw new MessageException("Service Does Not Support Command Type " + msg.getOperation());
        }
        return "success";
    }
View Full Code Here

            topic = (Topic)destination;
        }
        catch (ClassCastException cce)
        {
            // JMS topic proxy for JMS destination ''{0}'' has a destination type of ''{1}'' which is not Topic.
            MessageException me = new MessageException();
            me.setMessage(JMSConfigConstants.NON_TOPIC_DESTINATION, new Object[] {destinationJndiName, destination.getClass().getName()});
            throw me;
        }

        // Create connection
        try
        {
            TopicConnectionFactory topicFactory = (TopicConnectionFactory)connectionFactory;
            if (connectionCredentials != null)
                connection = topicFactory.createTopicConnection(connectionCredentials.getUsername(), connectionCredentials.getPassword());
            else
                connection = topicFactory.createTopicConnection();
        }
        catch (ClassCastException cce)
        {
            // JMS topic proxy for JMS destination ''{0}'' has a connection factory of type ''{1}'' which is not TopicConnectionFactory.
            MessageException me = new MessageException();
            me.setMessage(JMSConfigConstants.NON_TOPIC_FACTORY, new Object[] {destinationJndiName, connectionFactory.getClass().getName()});
            throw me;
        }

        // Create topic session on the connection
        TopicConnection topicConnection = (TopicConnection)connection;
View Full Code Here

    {
        JMSConsumer consumer = (JMSConsumer)evt.getSource();
        JMSException jmsEx = evt.getJMSException();

        // Client is unsubscribed because its corresponding JMS consumer for JMS destination ''{0}'' encountered an error during message delivery: {1}
        MessageException messageEx = new MessageException();
        messageEx.setMessage(JMSConfigConstants.CLIENT_UNSUBSCRIBE_DUE_TO_MESSAGE_DELIVERY_ERROR, new Object[] {consumer.getDestinationJndiName(), jmsEx.getMessage()});
        removeConsumer(consumer, true, true, messageEx.createErrorMessage());
    }
View Full Code Here

                        producer.initialize(settings);
                        producer.start();
                    }
                    catch (Exception e)
                    {
                        throw new MessageException(e);
                    }
                }
                else
                {
                    producer = topicProducers.removeFirst();
                }

                topicProducers.addLast(producer);
            }
        }
        else if (settings.getDestinationType().equals(QUEUE))
        {
            synchronized (queueProducers)
            {
                if (queueProducers.size() < settings.getMaxProducers())
                {
                    producer = new JMSQueueProducer();
                    try
                    {
                        producer.initialize(settings);
                        producer.start();
                    }
                    catch (Exception e)
                    {
                        throw new MessageException(e);
                    }
                }
                else
                {
                    producer = queueProducers.removeFirst();
                }

                queueProducers.addLast(producer);
            }
        }

        try
        {
            if (producer != null)
                producer.sendMessage(message);
        }
        catch (JMSException jmsEx)
        {
            // At this point we give up on this producer, so we just
            // stop and remove it from the pool.
            if (settings.getDestinationType().equals(TOPIC))
            {
                synchronized (topicProducers)
                {
                    if (producer != null)
                    {
                        producer.stop();
                        topicProducers.remove(producer);
                    }
                }
            }
            else if (settings.getDestinationType().equals(QUEUE))
            {
                synchronized (queueProducers)
                {
                    if (producer != null)
                    {
                        producer.stop();
                        queueProducers.remove(producer);
                    }
                }
            }

            throw new MessageException(jmsEx);
        }

        return null;
    }
View Full Code Here

TOP

Related Classes of flex.messaging.MessageException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.