public void startAndRegisterClientToMBusServer(){
		MBusConfiguration.initConfig();
		MBusConfiguration.initializeClientQueue();
		ServerSocket clientSocket = null;
		try {
			clientSocket = new ServerSocket(this.onlineClientPort);
			this.registerOnlineClient();
		} catch (IOException e) {
			System.err.println("MBus client could not listen on port: "+this.onlineClientPort+".");
			System.exit(1);
		}
		System.out.println("MBus client is running at port : "+this.onlineClientPort+".");

		Socket serverSocket = null;
		while(true){
			try {
				System.out.println("Waiting for mbus server.....");
				serverSocket = clientSocket.accept();
			} catch (IOException e) {
				System.err.println("Accept failed.");
				e.printStackTrace();
			}        
			System.out.println(serverSocket.getInetAddress().toString()+" Connected");           
			try {
				List<Message> messages = this.readAndProcess(serverSocket);
				String serializedMessages = stringify(messages);
				Map<String,Object> hm = new HashMap<String,Object>();
				hm.put(Constants.MESSAGEBUS_TOPIC, this.topic);
				hm.put(Constants.MESSAGE_LIST, serializedMessages);
				Message m = new Message(hm);
				System.out.println("Sending : "+m.toString());
				if(messages != null){
					MessageBusProducer.writeToSocket(serverSocket, new Message(hm));
				}
			} catch (IOException e) {
				e.printStackTrace();
			} catch (QueueNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}