Examples of TransportService


Examples of com.almende.eve.transport.TransportService

      //local shortcut
      RequestParams requestParams = new RequestParams();
      requestParams.put(Sender.class, senderUrl);
      return receive(receiverId,request,requestParams);
    } else {
      TransportService service = null;
      String protocol = null;
      int separator = receiverUrl.indexOf(":");
      if (separator != -1) {
        protocol = receiverUrl.substring(0, separator);
        service = getTransportService(protocol);
      }
      if (service != null) {
        JSONResponse response = service.send(
            senderUrl,
            receiverUrl,
            request);
        return response;
      } else {
View Full Code Here

Examples of com.almende.eve.transport.TransportService

            callback.onFailure(e);
          }
        }
      }).start();
    } else {
      TransportService service = null;
      String protocol = null;
      String senderUrl = null;
      if (sender != null) {
        senderUrl = getSenderUrl(sender.getId(), receiverUrl);
      }
      int separator = receiverUrl.indexOf(":");
      if (separator != -1) {
        protocol = receiverUrl.substring(0, separator);
        service = getTransportService(protocol);
      }
      if (service != null) {
        service.sendAsync(senderUrl, receiverUrl, request,
            callback);
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
                + protocol + "'.");
View Full Code Here

Examples of com.almende.eve.transport.TransportService

                      + " must implement "
                      + TransportService.class.getName());
            }
           
            // initialize the transport service
            TransportService transport = (TransportService) transportClass
                .getConstructor(AgentFactory.class, Map.class)
                .newInstance(this, transportParams);
           
            // register the service with the agent factory
            addTransportService(transport);
View Full Code Here

Examples of com.almende.eve.transport.TransportService

      // local shortcut
      RequestParams requestParams = new RequestParams();
      requestParams.put(Sender.class, senderUrl);
      return receive(receiverId, request, requestParams);
    } else {
      TransportService service = null;
      service = getTransportService(protocol);
     
      if (service != null) {
        JSONResponse response = service.send(senderUrl,
            receiverUrl.toASCIIString(), request);
        return response;
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
View Full Code Here

Examples of com.almende.eve.transport.TransportService

            callback.onFailure(e);
          }
        }
      }).start();
    } else {
      TransportService service = null;
      String protocol = null;
      String senderUrl = null;
      if (sender != null) {
        senderUrl = getSenderUrl(sender.getId(),
            receiverUrl.toASCIIString());
      }
      protocol = receiverUrl.getScheme();
      service = getTransportService(protocol);
      if (service != null) {
        service.sendAsync(senderUrl, receiverUrl.toASCIIString(),
            request, callback);
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
                + protocol + "'.");
View Full Code Here

Examples of com.almende.eve.transport.TransportService

                      + " must implement "
                      + TransportService.class.getName());
            }
           
            // initialize the transport service
            TransportService transport = (TransportService) transportClass
                .getConstructor(AgentHost.class, Map.class)
                .newInstance(this, transportParams);
           
            // register the service with the agent factory
            addTransportService(transport);
View Full Code Here

Examples of com.almende.eve.transport.TransportService

      delete();
    } else if ("setSchedulerFactory".equals(event.getEvent())) {
      // init scheduler tasks
      agentHost.getScheduler(this);
    } else if ("addTransportService".equals(event.getEvent())) {
      TransportService service = (TransportService) event.getService();
      service.reconnect(getId());
    }
  }
View Full Code Here

Examples of com.almende.eve.transport.TransportService

       
        // TODO: getting an arbitrary http service which knows this agent
        //       is not safe
        //       -> Scheduler should be configured with the servlet_url
        //          that it should use specified?
        TransportService service = null;
        for (TransportService s : agentFactory.getTransportServices("http")) {
          if (s.getAgentUrl(agentId) != null) {
            service = s;
            break;
          }
        }
        String url = null;
        if (service != null) {
          url = service.getAgentUrl(agentId);
        }
       
        URL uri = new URL(url);
        String path = uri.getPath();   
        Queue queue = QueueFactory.getDefaultQueue();
View Full Code Here

Examples of de.willuhn.jameica.services.TransportService

   */
  private static byte[] fetch(String url) throws ApplicationException
  {
    try
    {
      TransportService ts = Application.getBootLoader().getBootable(TransportService.class);
      Transport t = ts.getTransport(new URL(url));
     
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      t.get(bos,new ConsoleMonitor());
      return bos.toByteArray();
    }
View Full Code Here

Examples of org.elasticsearch.transport.TransportService

    @Test public void testSimplePings() {
        ThreadPool threadPool = new ThreadPool();
        ClusterName clusterName = new ClusterName("test");
        NettyTransport transportA = new NettyTransport(threadPool);
        final TransportService transportServiceA = new TransportService(transportA, threadPool).start();
        final DiscoveryNode nodeA = new DiscoveryNode("A", transportServiceA.boundAddress().publishAddress());

        InetSocketTransportAddress addressA = (InetSocketTransportAddress) transportA.boundAddress().publishAddress();

        NettyTransport transportB = new NettyTransport(threadPool);
        final TransportService transportServiceB = new TransportService(transportB, threadPool).start();
        final DiscoveryNode nodeB = new DiscoveryNode("B", transportServiceA.boundAddress().publishAddress());

        InetSocketTransportAddress addressB = (InetSocketTransportAddress) transportB.boundAddress().publishAddress();

        Settings hostsSettings = ImmutableSettings.settingsBuilder().putArray("discovery.zen.ping.unicast.hosts",
                addressA.address().getAddress().getHostAddress() + ":" + addressA.address().getPort(),
                addressB.address().getAddress().getHostAddress() + ":" + addressB.address().getPort())
                .build();

        UnicastZenPing zenPingA = new UnicastZenPing(hostsSettings, threadPool, transportServiceA, clusterName);
        zenPingA.setNodesProvider(new DiscoveryNodesProvider() {
            @Override public DiscoveryNodes nodes() {
                return DiscoveryNodes.newNodesBuilder().put(nodeA).localNodeId("A").build();
            }
        });
        zenPingA.start();

        UnicastZenPing zenPingB = new UnicastZenPing(hostsSettings, threadPool, transportServiceB, clusterName);
        zenPingB.setNodesProvider(new DiscoveryNodesProvider() {
            @Override public DiscoveryNodes nodes() {
                return DiscoveryNodes.newNodesBuilder().put(nodeB).localNodeId("B").build();
            }
        });
        zenPingB.start();

        try {
            ZenPing.PingResponse[] pingResponses = zenPingA.pingAndWait(TimeValue.timeValueSeconds(1));
            assertThat(pingResponses.length, equalTo(1));
            assertThat(pingResponses[0].target().id(), equalTo("B"));
        } finally {
            zenPingA.close();
            zenPingB.close();
            transportServiceA.close();
            transportServiceB.close();
            threadPool.shutdown();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.