Friday 27 July 2012

OMNIKEY 3821 driver popups when inserting card

This PINpad installs easily and generally plays nice, but on Windows 7 you get an annoying and unsuccessful attempt to install a driver (with associated popups) every time you insert a card.

This is caused by the Microsoft Smartcard PnP service, which can be disabled by adding the following registry key (Although this is a simple fix, note Microsoft's advice:  This is the least-recommended option. You should use this option only if the cards are legacy cards and there are no plans to implement smart card minidrivers in future.)


HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP
EnableScPnP   REG_DWORD   00000000

You'll probably need to reboot as well.

Further reading:
http://www.hidglobal.com/main/technical-support/ 
http://support.microsoft.com/kb/976832
http://lazybit.com/index.php/2010/10/20/smart-card-driver-for-windows-7-popup

Wednesday 18 July 2012

Spring Integration Exception Handling

Sooner or later you're going to have to deal with exceptions, it's essential that you understand exactly how they work, yet the Spring Integration documentation is fairly lightweight in this area.  Start by reading this as many times as it takes to sink in:  Error Handling

Understand the key differences between direct and asynchronous communication:
  1. With direct channels there is no hand-off between threads, the functionality is all handled in the same thread and exceptions (wrapped in a MessageHandlingException) are propagated and caught as usual
  2. Asynchronous commmunication - for example a queue channel - involves multiple threads, this creates complexity like how to pass back exceptions and transaction management (the standard transaction context is thread bound).  To handle the asynchronous exception problem SI wraps the exception in an ErrorMessage and places it on an error channel (again read the Error Handling link to understand which error channel it will choose).  You can call getPayload() and generally cast the result to a MessagingException.