Section 12. A justice of the peace, upon receipt of a certificate of the clerk of a court of record in the state of Maine or in a state adjoining this commonwealth that a criminal prosecution is pending in such court, and that a resident of the commonwealth is supposed to be a material witness therein, shall issue a summons requiring such witness to appear and testify at the court in which such case is pending.