Subversion Repositories SmartDukaan

Rev

Rev 7508 | Rev 7531 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7508 Rev 7512
Line 137... Line 137...
137
 
137
 
138
	}
138
	}
139
 
139
 
140
	final public static String AMAZON_ORDER_ACKNOWLEDGEMENT_XML = "/home/vikram/OrderAcknowledgeMent.xml";
140
	final public static String AMAZON_ORDER_ACKNOWLEDGEMENT_XML = "/home/vikram/OrderAcknowledgeMent.xml";
141
 
141
 
142
	static final int INTERVAL_IN_MINS = 1; // 15-minute update interval
142
	static final int INTERVAL_IN_MINS = 1; // 1-minute update interval
143
 
143
 
144
	//static final int INTERVAL_IN_MINS = 15; // 15-minute update interval
144
	//static final int INTERVAL_IN_MINS = 15; // 15-minute update interval
145
 
145
 
146
	protected MarketplaceWebServiceOrders service;
146
	protected MarketplaceWebServiceOrders service;
147
	protected String sellerId = null;
147
	protected String sellerId = null;
Line 175... Line 175...
175
			public void run() {
175
			public void run() {
176
				orderFetcher.startPeriodicSynch();
176
				orderFetcher.startPeriodicSynch();
177
			}
177
			}
178
		});
178
		});
179
 
179
 
180
		// Start the FetchOrderUpdatesJob in the second thread.
180
		// Start the FetchOrderUpdatesJobandAcknowledge in the second thread.
181
		fetchOrderUpdatesJobThread.start();
181
		fetchOrderUpdatesJobThread.start();
182
 
182
 
183
		/*
183
		/*
184
		 * The following code puts this thread to sleep for an hour and then the
184
		 * The following code puts this thread to sleep for an hour and then the
185
		 * stopSynch() method is called which stops the job in the second
185
		 * stopSynch() method is called which stops the job in the second
Line 198... Line 198...
198
			log.error(e.getMessage(), e);
198
			log.error(e.getMessage(), e);
199
			return;
199
			return;
200
		}
200
		}
201
 
201
 
202
		log.info("Main thread setting keepRunning to false.");
202
		log.info("Main thread setting keepRunning to false.");
203
		orderFetcher.stopSynch(); // Stops the FetchOrderUpdatesJob thread.
203
		orderFetcher.stopSynch(); // Stops the FetchOrderUpdatesJobandAcknowledge thread.
204
 
204
 
205
		// Join the two threads and wait for the fetchOrderUpdatesJobThread to
205
		// Join the two threads and wait for the fetchOrderUpdatesJobThread to
206
		// finish.
206
		// finish.
207
		try {
207
		try {
208
			fetchOrderUpdatesJobThread.join();
208
			fetchOrderUpdatesJobThread.join();
Line 266... Line 266...
266
			else if (timeWaited >= INTERVAL_IN_MINS * 60L * 1000L) {
266
			else if (timeWaited >= INTERVAL_IN_MINS * 60L * 1000L) {
267
				log.info("Time to fetch new order updates.");
267
				log.info("Time to fetch new order updates.");
268
				
268
				
269
				XMLGregorianCalendar endTime = fetchOrderUpdatesSince(startTime);
269
				XMLGregorianCalendar endTime = fetchOrderUpdatesSince(startTime);
270
				//System.out.println("End Time is : " + endTime.getDay() +"-"+ endTime.getMonth()+"-" + endTime.getHour()+":"+endTime.getMinute());
270
				//System.out.println("End Time is : " + endTime.getDay() +"-"+ endTime.getMonth()+"-" + endTime.getHour()+":"+endTime.getMinute());
271
				createandsubmitOrderAcknowlegementFeed();
271
				//createandsubmitOrderAcknowlegementFeed();
272
				if (endTime != null) {
272
				if (endTime != null) {
273
					startTime = endTime;
273
					startTime = endTime;
274
				} else {
274
				} else {
275
					log.info("endTime returned is null. Sleeping for "
275
					log.info("endTime returned is null. Sleeping for "
276
							+ INTERVAL_IN_MINS + " minutes.");
276
							+ INTERVAL_IN_MINS + " minutes.");
Line 909... Line 909...
909
 
909
 
910
	}
910
	}
911
 
911
 
912
	public int submitAcknowledgementFeed(){
912
	public int submitAcknowledgementFeed(){
913
 
913
 
914
	 	SubmitFeedRequest request= new SubmitFeedRequest();
914
		SubmitFeedRequest request= new SubmitFeedRequest();
915
		final String merchantId = "AF6E3O0VE0X4D";	
915
		final String merchantId = "AF6E3O0VE0X4D";	
916
		// marketplaces to which this feed will be submitted; look at the
916
		// marketplaces to which this feed will be submitted; look at the
917
		// API reference document on the MWS website to see which marketplaces are
917
		// API reference document on the MWS website to see which marketplaces are
918
		// included if you do not specify the list yourself
918
		// included if you do not specify the list yourself
919
		final IdList marketplaces = new IdList(Arrays.asList(
919
		final IdList marketplaces = new IdList(Arrays.asList(
Line 1044... Line 1044...
1044
			System.out.println("Request ID: " + ex.getRequestId());
1044
			System.out.println("Request ID: " + ex.getRequestId());
1045
			System.out.print("XML: " + ex.getXML());
1045
			System.out.print("XML: " + ex.getXML());
1046
			System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata());
1046
			System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata());
1047
			return -1;
1047
			return -1;
1048
		}
1048
		}
1049
		
1049
 
1050
	}
1050
	}
1051
 
1051
 
1052
}
1052
}