cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tho huynh ngoc <ngocthob...@gmail.com>
Subject Transfer the requests between servers and responds clients
Date Mon, 26 Oct 2015 10:35:37 GMT
Hi,


I have a service implemented as follows

*public* *class* Server *implements* Service{

*public* Server() {

Bus bus = BusFactory.*getDefaultBus*();

WorkQueueManager wqm = bus.getExtension(WorkQueueManager.*class*);

AutomaticWorkQueueImpl wq = *new* AutomaticWorkQueueImpl("udp-transport");

wq.setHighWaterMark(25);

wq.setQueueSize(512); ///queue size, *min*: 1, max: 2^31-1, default:256

wqm.addNamedWorkQueue("udp-transport", wq);

//Declare server service

System.*out*.println("Server");

JaxWsServerFactoryBean factory = *new* JaxWsServerFactoryBean();

factory.setAddress("udp://192.168.56.1:9191/print");

factory.setServiceClass(Service.*class*);

factory.setServiceBean(*this*);

factory.getInInterceptors().add(*new* LoggingInInterceptor());

factory.getOutInterceptors().add(*new* LoggingOutInterceptor());

org.apache.cxf.endpoint.Server server = factory.create();

server.start();

}


*public* String print(String str) {

*return* "respond "+str;

}

}

This service is deployed on the server 192.168.56.1 (A) and on the server
192.168.1.2 (B)


The client side is implemented as follows

*public* *class* Client {

*public* Service printService;

@Property (name="setAddr")

String addr = "udp://192.168.56.1:9191/print"; //connect to server

*public* JaxWsProxyFactoryBean factory;

*public* Client() {

factory = *new* JaxWsProxyFactoryBean();

factory.getInInterceptors().add(*new* LoggingInInterceptor());

factory.getOutInterceptors().add(*new* LoggingOutInterceptor());

factory.setServiceClass(Service.*class*);

factory.setAddress(addr);

Map<String, Object> props = *new* HashMap<String,Object>();

props.put("cxf.synchronous.timeout", *new* Integer(60000));

factory.setProperties(props);

printService = (Service) factory.create();

//here: create 1000 independent threads to send requests

//printService.print("test");

}}

Suppose that this client that connect to the server A (192.168.56.1) and send
1000 requests (100 threads, each thread sends a message). After receiving
40 responses, the client disconnects 192.168.56.1 (A) and connects to
192.168.56.2 (B).

How to transfer the 60 remain requests in the server A into the server B ?

And how to the server B responds to the client ?


Anyone please help me ?


Regards,
Tho,

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message