Package com.opengamma.util.jms

Examples of com.opengamma.util.jms.JmsConnector


    return factory.getObjectCreating();
  }

  private JmsConnector getJmsConnector(ComponentInfo info) {
    URI jmsBrokerUri = URI.create(info.getAttribute("jmsBrokerUri"));
    JmsConnector jmsConnector = getJmsConnector(jmsBrokerUri);
    return jmsConnector;
  }
View Full Code Here


    final LiveDataMetaData metaData = provider.metaData();
    final URI jmsUri = metaData.getJmsBrokerUri();
    if (metaData.getServerType() != LiveDataServerTypes.STANDARD || jmsUri == null) {
      throw new IllegalStateException();
    }
    JmsConnector jmsConnector = getJmsConnector();
    if (jmsConnector.getClientBrokerUri().equals(jmsUri) == false) {
      final JmsConnectorFactoryBean jmsFactory = new JmsConnectorFactoryBean(jmsConnector);
      jmsFactory.setClientBrokerUri(jmsUri);
      jmsConnector = jmsFactory.getObjectCreating();
    }
View Full Code Here

    JmsConnectorFactoryBean jmsConnectorFactoryBean = new com.opengamma.util.jms.JmsConnectorFactoryBean();
    jmsConnectorFactoryBean.setName("StandardJms");
    jmsConnectorFactoryBean.setConnectionFactory(jmsConnectionFactory);
    jmsConnectorFactoryBean.setClientBrokerUri(URI.create(activeMQUrl));
   
    JmsConnector jmsConnector = jmsConnectorFactoryBean.getObjectCreating();
    ByteArrayFudgeMessageReceiver fudgeReceiver = new ByteArrayFudgeMessageReceiver(new FudgeMessageReceiver() {
     
      @Override
      public void messageReceived(FudgeContext fudgeContext, FudgeMsgEnvelope msgEnvelope) {
        FudgeMsg message = msgEnvelope.getMessage();
        s_logger.debug("received {}", message);
      }
    }, s_fudgeContext);
    final JmsByteArrayMessageDispatcher jmsDispatcher = new JmsByteArrayMessageDispatcher(fudgeReceiver);
   
    Connection connection = jmsConnector.getConnectionFactory().createConnection();
    connection.start();
   
    pushTrade("ARG", connection, destinationName, jmsConnector, jmsDispatcher);
    Thread.sleep(WAIT_BTW_TRADES);
    pushTrade("MMM", connection, destinationName, jmsConnector, jmsDispatcher);
View Full Code Here

  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {

    final ComponentInfo info = new ComponentInfo(JmsConnector.class, getClassifier());
    final JmsConnector component = initJmsConnector();
    repo.registerComponent(info, component);

  }
View Full Code Here

    final URI jmsUri = metaData.getJmsBrokerUri();
    if (jmsUri == null) {
      throw new OpenGammaRuntimeException("JMS URI not set in metadata " + metaData);
    }

    JmsConnector jmsConnector = getJmsConnector();
    if (jmsConnector.getClientBrokerUri().equals(jmsUri) == false) {
      final JmsConnectorFactoryBean jmsFactory = new JmsConnectorFactoryBean(jmsConnector);
      jmsFactory.setClientBrokerUri(jmsUri);
      jmsConnector = jmsFactory.getObjectCreating();
    }
View Full Code Here

    return Response.ok().build();
  }

  public void testGetBlacklist() {
    final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    final JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector("RemoteManageableFunctionBlacklistProviderTest.testGetBlacklist");
    try {
      final InMemoryFunctionBlacklistProvider underlying = new InMemoryFunctionBlacklistProvider(executor);
      final DataManageableFunctionBlacklistProviderResource server = new DataManageableFunctionBlacklistProviderResource(underlying, OpenGammaFudgeContext.getInstance(), jmsConnector);
      final ManageableFunctionBlacklistProvider client = createClient(executor, jmsConnector, server);
      final ManageableFunctionBlacklist foo = client.getBlacklist("Foo");
      assertNotNull(foo);
      assertEquals(foo.getName(), "Foo");
      assertEquals(foo.getModificationCount(), 0);
      final ManageableFunctionBlacklist bar = client.getBlacklist("Bar");
      assertNotNull(bar);
      assertEquals(bar.getName(), "Bar");
      assertEquals(bar.getModificationCount(), 0);
    } finally {
      executor.shutdown();
      jmsConnector.close();
    }
  }
View Full Code Here

    }
  }

  public void testReceiveUpdates() throws InterruptedException {
    final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    final JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector("RemoteManageableFunctionBlacklistProviderTest.testReceiveUpdates");
    try {
      final InMemoryFunctionBlacklistProvider underlying = new InMemoryFunctionBlacklistProvider(executor);
      final DataManageableFunctionBlacklistProviderResource server = new DataManageableFunctionBlacklistProviderResource(underlying, OpenGammaFudgeContext.getInstance(), jmsConnector);
      final ManageableFunctionBlacklistProvider client = createClient(executor, jmsConnector, server);
      final FunctionBlacklist clientBlacklist = client.getBlacklist("Test");
      final ManageableFunctionBlacklist serverBlacklist = underlying.getBlacklist("Test");
      RemoteFunctionBlacklistProviderTest.testRuleUpdates(serverBlacklist, clientBlacklist);
    } finally {
      executor.shutdown();
      jmsConnector.close();
    }
  }
View Full Code Here

    }
  }

  public void testPostUpdates() throws InterruptedException {
    final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    final JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector("RemoteManageableFunctionBlacklistProviderTest.testPostUpdates");
    try {
      final InMemoryFunctionBlacklistProvider underlying = new InMemoryFunctionBlacklistProvider(executor);
      final DataManageableFunctionBlacklistProviderResource server = new DataManageableFunctionBlacklistProviderResource(underlying, OpenGammaFudgeContext.getInstance(), jmsConnector);
      final ManageableFunctionBlacklistProvider client = createClient(executor, jmsConnector, server);
      final ManageableFunctionBlacklist clientBlacklist = client.getBlacklist("Test");
      final FunctionBlacklist serverBlacklist = underlying.getBlacklist("Test");
      RemoteFunctionBlacklistProviderTest.testRuleUpdates(clientBlacklist, serverBlacklist);
    } finally {
      executor.shutdown();
      jmsConnector.close();
    }
  }
View Full Code Here

    return blacklist.info(Integer.parseInt(uri[4]));
  }

  public void testGetBlacklist () {
    final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    final JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector("RemoteFunctionBlacklistProviderTest.testGetBlacklist");
    try {
      final InMemoryFunctionBlacklistProvider underlying = new InMemoryFunctionBlacklistProvider(executor);
      final DataFunctionBlacklistProviderResource server = new DataFunctionBlacklistProviderResource(underlying, OpenGammaFudgeContext.getInstance(), jmsConnector);
      final FunctionBlacklistProvider client = createClient(executor, jmsConnector, server);
      final FunctionBlacklist foo = client.getBlacklist("Foo");
      assertNotNull(foo);
      assertEquals(foo.getName(), "Foo");
      assertEquals(foo.getModificationCount(), 0);
      final FunctionBlacklist bar = client.getBlacklist("Bar");
      assertNotNull(bar);
      assertEquals(bar.getName(), "Bar");
      assertEquals(bar.getModificationCount(), 0);
    } finally {
      executor.shutdown();
      jmsConnector.close();
    }
  }
View Full Code Here

    assertFalse(receive.getRules().contains(rule2));
  }

  public void testReceiveUpdates() throws InterruptedException {
    final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    final JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector("RemoteFunctionBlacklistProviderTest.testReceiveUpdates");
    try {
      final InMemoryFunctionBlacklistProvider underlying = new InMemoryFunctionBlacklistProvider(executor);
      final DataFunctionBlacklistProviderResource server = new DataFunctionBlacklistProviderResource(underlying, OpenGammaFudgeContext.getInstance(), jmsConnector);
      final FunctionBlacklistProvider client = createClient(executor, jmsConnector, server);
      final FunctionBlacklist clientBlacklist = client.getBlacklist("Test");
      final ManageableFunctionBlacklist serverBlacklist = underlying.getBlacklist("Test");
      testRuleUpdates(serverBlacklist, clientBlacklist);
    } finally {
      executor.shutdown();
      jmsConnector.close();
    }
  }
View Full Code Here

TOP

Related Classes of com.opengamma.util.jms.JmsConnector

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.