Can I apply for US B1 visitor visa if my Family based immigration is in process?

I have my family immigration petition pending as the priority date has not been current.

In the mean time, i would like to visit my family in USA for marriage.

Is it possible to apply for B1/B2 visa while my immigration petition is pending?

Will the visa officer consider my B1 application in violation of my immigrant intent?

Apply B1/B2 when Immigration petiton is pending

Yes, you can apply for a US tourist or business visa even if you intend to immigrate later.

Visa officer has information about your pending family immigration petition and may ask you questions about it and your current INTENT.
If you can convince Visa officer that you plan to return to your country with this B1/B2 visa after attending the marriage, he should have no issues in giving you visitor visa.