cronjob-notification-redis

1.0.0 • Public • Published

��#� �R�e�d�i�s� �n�o�t�i�f�i�c�a�t�i�o�n� �h�a�s�h�e�s� �f�o�r� �C�r�o�n�J�o�b� �p�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� � �A� �l�i�g�h�t�w�a�y� �n�o�t�i�f�i�c�a�t�i�o�n� �h�a�s�h� �f�o�r� �N�o�d�e�j�s� �t�h�a�t� �c�r�e�a�t�e� �s�c�h�e�d�u�l�e� �p�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� �e�v�e�r�y� �t�i�m�e� �d�e�f�i�n�e�.� � � � �#�#� �F�e�a�t�u�r�e�s� � � � �� �C�r�e�a�t�e� �h�a�s�h�e�s� �f�o�r� �n�o�t�i�f�i�c�a�t�i�o�n�s�(�k�e�y�,� �m�e�s�s�a�g�e�)� �t�o� �p�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� �t�o� �m�o�b�i�l�e�,� �w�e�b� �.�.�.� � �� �M�e�t�h�o�d� �p�u�s�h�N�o�t�i�f�i�c�a�t�i�o�n� �a�n�d� �h�a�n�d�l�e�E�r�r�o�r� �i�s� �d�e�f�i�n�e� �e�x�t�e�r�n�a�l�.� � �� �U�s�e�r� �c�a�n� �d�e�f�i�n�e� �t�i�m�e� �i�n�t�e�r�v�a�l� �f�o�r� �s�c�h�e�d�u�l�e�.� �E�v�e�r�y� �t�i�m�e� �i�n�t�e�r�v�a�l� �d�e�f�i�n�e�,� �s�y�s�t�e�m� �g�e�t� �a�l�l� �n�o�t�i�f�i�c�a�t�i�o�n� �a�n�d� �p�u�s�h� �t�h�e�m� �t�o� �d�e�v�i�c�e�s� �v�i�a� �f�u�n�c�t�i�o�n� �p�u�s�h�N�o�t�i�f�i�c�a�t�i�o�n� �w�h�i�c�h� �u�s�e�r� �d�e�f�i�n�e�.� � � � �#�#� �I�n�s�t�a�l�l� � � � ��n�p�m� �i�n�s�t�a�l�l� �c�r�o�n�-�n�o�t�i�-�r�e�d�i�s�� � � � �#�#� �E�x�a�m�p�l�e�s� � � � �#�#�#� �I�n�i�t�i�a�l�i�z�e� � � � ��j�a�v�a�s�c�r�i�p�t� � �R�e�d�i�s�S�N� �=� �r�e�q�u�i�r�e�(�'�c�r�o�n�-�n�o�t�i�-�r�e�d�i�s�'�)�;� � �� � � � �#�#�#� �C�r�e�a�t�e� �a� �h�a�s�h�e�s� � � � �C�r�e�a�t�e� �a� �h�a�s�h�e�s� �w�i�t�h� �p�r�e�-�d�e�f�i�n�e� �m�e�t�h�o�d� �p�u�s�h�N�o�t�i�f�i�c�a�t�i�o�n� �a�n�d� �h�a�n�d�e�E�r�r�o�r� � � � �P�a�r�a�m�e�t�e�r�s�:� � � � �� ��p�u�s�h��:� �f�u�n�c�t�i�o�n� �p�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� � �� ��h�a�n�d�l�e��:� �h�a�n�d�l�e� �e�r�r�o�r� �o�f� �h�a�s�h�e�s� � �� ��o�p�t�i�o�n�s��:� ��o�p�t�i�o�n�a�l� � ��{� � � � � � �n�a�m�e�:� �"�R�e�d�i�s�C�N�Q�"�,� � � � � � �r�e�d�i�s�O�p�t�i�o�n�s�:� �{� � � � � � � � �h�o�s�t�:� �"�1�2�7�.�0�.�0�.�1�"�,� � � � � � � � �p�o�r�t�:� �6�3�7�9� � � � � � �}�,� � � � � � �s�c�h�e�d�u�l�e�:� �{� � � � � � � � �h�o�u�r�:� �'�*�'�,� � � � � � � � �m�i�n�u�t�e�:� �'�*�'� � � � � � �}� � � � �}�� � � � ��j�a�v�a�s�c�r�i�p�t� � �f�u�n�c�t�i�o�n� �h�a�n�d�l�e�(�e�r�r�)� �{� � � � �c�o�n�s�o�l�e�.�l�o�g�(�'�E�R�R�O�R�:� �'� �+� �e�r�r�.�m�e�s�s�a�g�e�)�;� � �}� � � � �f�u�n�c�t�i�o�n� �p�u�s�h�(�q�)� �{� � � � �/�/� �P�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� �t�o� �d�e�v�i�c�e�s� �i�n� �h�e�r�e�.� � � � �l�e�t� �t�i�m�e� �=� �n�e�w� �D�a�t�e�(�D�a�t�e�.�n�o�w�(�)�)�;� � � � �i�f� �(�!�q�)� �{� � � � � � �c�o�n�s�o�l�e�.�l�o�g�(�t�i�m�e� �+� �'� �:� �Q�u�e�u�e� �e�m�p�t�y�.�'�)�;� � � � �}� � � � �_�.�f�o�r�E�a�c�h�(�q�,� �f�u�n�c�t�i�o�n�(�v�a�l�,� �k�e�y�)� �{� � � � � � �c�o�n�s�o�l�e�.�l�o�g�(�t�i�m�e� �+� �'� �:� �'�,� �k�e�y�,� �v�a�l�)�;� � � � �}�)�;� � �}� � � � �c�o�n�s�t� �s�c�h�e�d�u�l�e� �=� �n�e�w� �R�e�d�i�s�S�N�(�p�u�s�h�,� �h�a�n�d�l�e�,� �o�p�t�i�o�n�s�)�;� � �� � � � �#�#� � � � �#�#�#� �A�d�d� �n�o�t�i�f�i�c�a�t�i�o�n� �t�o� �h�a�s�h�e�s� � � � �A�d�d� �n�o�t�i�f�i�c�a�t�i�o�n� �t�o� �h�a�s�h�s�e�s� �i�f� �k�e�y� �e�x�i�s�t�,� �o�l�d� �m�e�s�s�a�g�e� �w�i�l�l� �b�e� �r�e�p�l�a�c�e�d� � � � ��j�a�v�a�s�c�r�i�p�t� � �s�c�h�e�d�u�l�e�.�a�d�d�N�o�t�i�f�i�c�a�t�i�o�n�(�'�u�s�e�r�I�d�1�'�,� �'�X�Y�Z�.�A�B�C� �:� �Y�o�u�r� �h�a�v�e� �n�e�w� �m�e�s�s�a�g�e� �f�r�o�m� �f�r�i�e�n�d�.�'�)�;� � �� � � � �#�#�#� �R�e�m�o�v�e� �n�o�t�i�f�i�c�a�t�i�o�n� �t�o� �h�a�s�h�e�s� � � � �R�e�m�o�v�e� �n�o�t�i�f�i�c�a�t�i�o�n� �i�n� �h�a�s�h�e�s� � � � ��j�a�v�a�s�c�r�i�p�t� � �s�c�h�e�d�u�l�e�.�r�e�m�o�v�e�N�o�t�i�f�i�c�a�t�i�o�n�(�'�u�s�e�r�I�d�1�'�)�;� � �� � � � �#�#�#� �P�u�s�h� �n�o�t�i�f�i�c�a�t�i�o�n� � � � �P�u�s�h� �a�l�l� �n�o�t�i�f�i�c�a�t�i�o�n� �i�n� �h�a�s�h�e�s� �a�n�d� �r�e�m�o�v�e� �t�h�e�m� �f�r�o�m� �h�a�s�h� � � � �N�o�t�e�:� �t�h�i�s� �f�u�n�c�t�i�o�n� �w�i�l�l� �b�e� �a�u�t�o�m�a�t�i�c� �c�a�l�l�e�d� �i�n� �c�r�o�n�j�o�b�.� � � � ��j�a�v�a�s�c�r�i�p�t� � �s�c�h�e�d�u�l�e�.�p�u�s�h�N�o�t�i�f�i�c�a�t�i�o�n�(�)�;� � �

Package Sidebar

Install

npm i cronjob-notification-redis

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • levy193