Package com.betfair.cougar.core.api.exception

Examples of com.betfair.cougar.core.api.exception.CougarFrameworkException


            clientServiceRegistration.setNamespace(namespace);

            // register with ev
            cougarIntroductionService.registerService(clientServiceRegistration);
        } catch (Exception ex) {
            throw new CougarFrameworkException("Error while registering client with ev", ex);
        }
    }
View Full Code Here


        request.onResponseFailure(new Response.FailureListener() {
            @Override
            public void onFailure(Response response, Throwable failure) {
                ServerFaultCode faultCode = ServerFaultCode.RemoteCougarCommunicationFailure;
                if (failure instanceof TimeoutException) {
                    failure = new CougarFrameworkException("Read timed out", failure);
                    faultCode = ServerFaultCode.Timeout;
                }
                LOGGER.warn("COUGAR: HTTP communication ERROR - URL [" + url + "] time [" + elapsed(startTime) + "mS]", failure);
                processException(obs, failure, url, faultCode);
            }
View Full Code Here

            message.setJMSExpiration(expirationTime);
            message.setJMSPriority(priority);

            return message;
        } catch (JMSException jmsex) {
            throw new CougarFrameworkException("Error marshalling Event", jmsex);
        } catch (UnknownHostException e) {
            throw new CougarFrameworkException("Error looking up local host name", e);
        }
    }
View Full Code Here

            publisherRunnable.lock();

            if (!publisherRunnable.isSuccess()) { // If publication failed for any reason pass out the exception thrown
                Exception e = publisherRunnable.getError();
                logger.log(Level.SEVERE, "Publication exception:", e);
                throw new CougarFrameworkException("Sonic JMS publication exception", e);
            }
        } catch (InterruptedException ex) { // Interrupted while waiting for event to be published
            logger.log(Level.SEVERE, "Publication exception:", ex);
            throw new CougarFrameworkException("Sonic JMS publication exception", ex);
        }
    }
View Full Code Here

                    break;
            }
            return destination;
        }
        catch (InvalidDestinationException ide) {
            throw new CougarFrameworkException("Error creating "+destinationType+" for destination name '"+destinationName+"'",ide);
        }
    }
View Full Code Here

        String destinationName = destinationResolver.resolveDestination(eventClass, null);
        String subId = null;

        if (destinationType == destinationType.DurableTopic) {
            if (args == null || "".equals(args[0])) {
                observer.onResult(new ExecutionResult(new CougarFrameworkException("Durable subscription requires a subscription Identifier to be set as the zeroth arg!")));
                return;
            }
            subId = args[0].toString();
        }

        try {
            final Session session = getConnection().createSession(false, acknowledgementMode);

            final TopicSubscriberPingMonitor pingMonitor = setupPingConsumer(eventName, destinationName, subId, session);

            MessageConsumer consumer = createConsumer(session, destinationName, subId);

            consumer.setMessageListener(new SubscriptionMessageListener(observer, eventClass, pingMonitor));

            subscriptionAdded(observer);

            observer.onResult(new ExecutionResult(new DefaultSubscription() {
                @Override
                public void preClose(CloseReason reason) {
                    try {
                        if (pingMonitor != null) {
                            if (monitorRegistry != null) {
                                monitorRegistry.removeMonitor(pingMonitor);
                            }
                            subscriberMonitorsBySession.remove(pingMonitor);
                        }
                        session.close();
                    } catch (JMSException ex) {
                        logger.log(Level.SEVERE, "Exception occurred when trying to close JMSConnection", ex);
                    }
                }
            }));
        } catch (JMSException ex) {
            observer.onResult(new ExecutionResult(new CougarFrameworkException("Subscription exception!", ex)));
        } catch (CougarException ce) {
            observer.onResult(new ExecutionResult(ce));
        }
    }
View Full Code Here

                    correctClass = c;
                    break;
                }
            }
            if (correctClass == null) {
                throw new CougarFrameworkException("Can't find event class for event named '"+eventNameFromMessage+"'");
            }

            AbstractEvent event = (AbstractEvent) dataBindingFactory.getUnMarshaller().unmarshall(is, correctClass, encodingType);

            event.setMessageId(transportEvent.getStringProperty(JMSPropertyConstants.MESSAGE_ID_FIELD_NAME));
            event.setCougarMessageRouteString(transportEvent.getStringProperty(JMSPropertyConstants.MESSAGE_ROUTING_FIELD_NAME));

            //When other types of JMS field types (eg, not stored in the message body) become necessary
            //This is where they'll be added

            return event;
        } catch (UnsupportedEncodingException ex) {
            //This is never going to happen in a month of Sundays
            throw new CougarFrameworkException("Unsupported encoding exception for JMS Event", ex);
        } catch (JMSException jmsex) {
            throw new CougarFrameworkException("Unsupported encoding exception for JMS Event", jmsex);
        }
    }
View Full Code Here

            String type = "null";
            if (m != null) {
                type = m.getClass().getName();
            }
            try {
                observer.onResult(new ExecutionResult(new CougarFrameworkException("Received message not a text message!",
                        new ClassCastException(
                                "Could not convert received message from type [" + type + "] to TextMessage"))));
            } catch (Exception e) {
                logger.log(e);
            }
View Full Code Here

            Session s = sessionMap.get(t);
            if (s == null) {
                try {
                    s = getConnection().createSession(false, acknowledgementMode);
                } catch (JMSException ex) {
                    throw new CougarFrameworkException("Error Creating Session", ex);
                }
                sessionMap.put(t, s);
            }
            return s;
        }
View Full Code Here

                            timeConstraints);

                } catch (CougarException e) {
                    newObserver.onResult(new ExecutionResult(e));
                    newObserver.onResult(new ExecutionResult(
                            new CougarFrameworkException(ServerFaultCode.ServiceRuntimeException, "Exception thrown by service method", e)));
                }
                catch (Exception e) {
                }
            }
        };
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.exception.CougarFrameworkException

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.