question

jessejoh avatar image
jessejoh asked sam Deactivated answered

Either the OrderConnector or Printing itself stops working after a certain threshold

Our app prints orders after being notified by our online ordering service.

When a certain threshold of orders are printed via our app in a short period (for example, 12 orders in 5 minutes), the printers simply stop working. No exceptions are thrown, no errors appear and nothing displays in the print queue. When we close and re-open the software, the issue persists. At some point it clears up and printing works again.

Are there any sort of internal limitations to OrderConnector.Fire and StaticBillPrintJobs? What could cause such strange behavior?

We didn't even notice this until we recently got a higher volume customer that was having printing issues for online orders, but no errors of any kind were displaying. We determined that the notifications were being received as data was being sent back to our server indicating so. Completely confused by this, I attempted a test of my own in the sandbox to reproduce their conditions. I tested 20 orders at random 5-60 second intervals, and the kitchen slip and payment receipt printed on the first 12. After that, the app notes that it receives an order and attempts to print, but no exceptions are thrown, there are no errors in the notification area, and nothing displays in the print queue. Each order was identical in contents and are confirmed to have been correctly received by Clover. The orders can also be seen in the clover order history. Closing and re-opening the app does not allow it to begin printing again. It appears that this issue only appears during higher volume times, as we have done plenty of order tests in the past without this issue (although probably not as frequent in a short span as today's test).

Here is the code that is inside the try block. This code works until used somewhat frequently as indicated above:

mAccount = CloverAccount.getAccount(MainActivity.this);

// PRINT KITCHEN
orderConnector = new OrderConnector(MainActivity.this, mAccount, null);
orderConnector.connect();
orderConnector.fire(order_id);
orderConnector.disconnect();

// PRINT RECEIPT
PrintJob pj = new StaticBillPrintJob.Builder().order(orderConnector.getOrder(order_id)).build();
pj.print(MainActivity.this, mAccount);


Any ideas with regards to how I might approach solving this issue? Am I doing something wrong?
Clover Android SDK
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

sam avatar image
sam Deactivated answered
We have not been able to reproduce this error but below could be a possible cause/solution.

If an employee isn't being assigned to the receipt, it may cause issues with printing. So you should check for an employee on the order and if one's not found, use the Owner’s employee ID and
assigning it to the order.
if(newOrder.getEmployee() == null){

	Reference employee = new Reference();

	employee.setId(Settings.OWNER_ID);

	newOrder.setEmployee(employee);

} 
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community